Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/go-code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
ssh-private-key: ${{ secrets.GRPC_GATEWAY_DEPLOY_KEY }}
- name: Check formatting and build
run: |
git config --global url."git@github.com:".insteadOf "https://github.com/"
go mod tidy
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
Expand Down Expand Up @@ -65,7 +64,6 @@ jobs:
LOGS_BUCKET: ${{ secrets.LOGS_BUCKET }}
GOPRIVATE: ${{ secrets.GOPRIVATE }}
run: |
git config --global url."git@github.com:".insteadOf "https://github.com/"
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
make test
Expand All @@ -92,7 +90,7 @@ jobs:
LOGS_BUCKET: ${{ secrets.LOGS_BUCKET }}
GOPRIVATE: ${{ secrets.GOPRIVATE }}
run: |
git config --global url."git@github.com:".insteadOf "https://github.com/"
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
make test-openapi
make test-openapi-ro
31 changes: 31 additions & 0 deletions .github/workflows/go-readonly-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "[Tools] Go Readonly Tests Image"

on:
workflow_dispatch:
push:
branches: [ master ]
paths:
- 'go/**'
- 'proto/**'
jobs:
build-example-image:
name: "[Tools] Build Go Readonly Tests Image"
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ vars.ECR_ROLE }}
aws-region: ${{ vars.DEFAULT_ECR_REGISTRY_REGION }}
- uses: aws-actions/amazon-ecr-login@v2
- uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
file: go/openapi/Dockerfile
push: true
tags: ${{ vars.DEFAULT_ECR_REGISTRY }}/go-readonly-tests:latest
44 changes: 0 additions & 44 deletions .github/workflows/protobuf-code-check.yml

This file was deleted.

3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ test:
test-openapi:
cd ./go; make test-openapi TESTARGS=${TESTARGS}

test-openapi-ro:
cd ./go; make test-openapi-ro TESTARGS=${TESTARGS}

proto-go-generate: proto-renew
cd ./go; make proto-clean; make proto-compile

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/grpc-ecosystem/grpc-gateway/v2 => github.com/coralogix/grpc-gateway/v2 v2.0.0-20251017075809-7f84c876b2e5
replace github.com/grpc-ecosystem/grpc-gateway/v2 => github.com/coralogix/grpc-gateway/v2 v2.0.0-20260113093058-adb9ff6b56db
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/coralogix/grpc-gateway/v2 v2.0.0-20251017075809-7f84c876b2e5 h1:mqmL/WJA8Cdzim6r3jmXY8uiPn9KX4AvqxjEPDRXKj4=
github.com/coralogix/grpc-gateway/v2 v2.0.0-20251017075809-7f84c876b2e5/go.mod h1:bqGO/kNOHTFiDIfPmXLQcox10aWQs5Q3b9sXUFoaFFk=
github.com/coralogix/grpc-gateway/v2 v2.0.0-20260113093058-adb9ff6b56db h1:v4wKbMIBYg4JZIaEpZF//EJFFrbcFIv0nuZtAX86PYE=
github.com/coralogix/grpc-gateway/v2 v2.0.0-20260113093058-adb9ff6b56db/go.mod h1:bqGO/kNOHTFiDIfPmXLQcox10aWQs5Q3b9sXUFoaFFk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
3 changes: 3 additions & 0 deletions go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,8 @@ test: build
test-openapi:
go test ${BUILD_ARGS} -v ${TESTARGS} -cover -timeout=120s -parallel=4 ./openapi/examples/...

test-openapi-ro:
go test ${BUILD_ARGS} -v ${TESTARGS} -cover -timeout=120s -parallel=8 ./openapi/tests/...

generate:
go generate
8 changes: 4 additions & 4 deletions go/examples/integrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func TestWebhooks(t *testing.T) {
crud(t, &cxsdk.CreateOutgoingWebhookRequest{
Data: &cxsdk.OutgoingWebhookInputData{
Name: wrapperspb.String("custom-webhook"),
Url: wrapperspb.String("https://example-url.com"),
Url: wrapperspb.String("https://api.staging.coralogix.net/mgmt/testing/tools/httpbin/get/"),
Type: cxsdk.WebhookTypeGeneric,
Config: &cxsdk.GenericWebhookInputData{
GenericWebhook: &cxsdk.GenericWebhookConfig{
Expand All @@ -195,7 +195,7 @@ func TestWebhooks(t *testing.T) {
crud(t, &cxsdk.CreateOutgoingWebhookRequest{
Data: &cxsdk.OutgoingWebhookInputData{
Name: wrapperspb.String("pager-duty-webhook"),
Url: wrapperspb.String("https://example-url.com/"),
Url: wrapperspb.String("https://api.staging.coralogix.net/mgmt/testing/tools/httpbin/post/"),
Type: cxsdk.WebhookTypePagerduty,
Config: &cxsdk.PagerDutyWebhookInputData{
PagerDuty: &cxsdk.PagerDutyConfig{
Expand All @@ -208,7 +208,7 @@ func TestWebhooks(t *testing.T) {
crud(t, &cxsdk.CreateOutgoingWebhookRequest{
Data: &cxsdk.OutgoingWebhookInputData{
Name: wrapperspb.String("email-group-webhook"),
Url: wrapperspb.String("https://example-url.com/"),
Url: wrapperspb.String("https://api.staging.coralogix.net/mgmt/testing/tools/httpbin/post/"),
Type: cxsdk.WebhookTypeEmailGroup,
Config: &cxsdk.EmailGroupWebhookInputData{
EmailGroup: &cxsdk.EmailGroupConfig{
Expand Down Expand Up @@ -236,7 +236,7 @@ func TestWebhooks(t *testing.T) {
crud(t, &cxsdk.CreateOutgoingWebhookRequest{
Data: &cxsdk.OutgoingWebhookInputData{
Name: wrapperspb.String("opsgenie-webhook"),
Url: wrapperspb.String("https://example.opsgenie.com"),
Url: wrapperspb.String("https://api.opsgenie.com"),
Type: cxsdk.WebhookTypeOpsgenie,
Config: &cxsdk.OpsgenieWebhookInputData{
Opsgenie: &cxsdk.OpsgenieConfig{},
Expand Down
42 changes: 42 additions & 0 deletions go/openapi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2026 Coralogix Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.




ARG TARGETARCH
FROM golang:1.25-alpine AS interim
FROM interim AS interim-amd64
ENV ARCH=x86_64
FROM interim AS interim-arm64
ENV ARCH=aarch_64

FROM interim-${TARGETARCH}


RUN apk add --no-cache make && \
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

# Set working directory
WORKDIR /app

# Copy Makefile and required files
COPY ../ .
# Set environment variables
ENV CORALOGIX_REGION=us
ENV CORALOGIX_API_KEY=test_key

# Run tests using Makefile target
CMD ["make", "test-openapi-ro"]
6 changes: 3 additions & 3 deletions go/openapi/examples/integrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func TestWebhooks(t *testing.T) {
&webhooks.OutgoingWebhookInputDataPagerDuty{
Name: webhooks.PtrString("pager-duty-webhook"),
Type: webhooks.WEBHOOKTYPE_PAGERDUTY.Ptr(),
Url: webhooks.PtrString("https://example-url.com/"),
Url: webhooks.PtrString("https://api.staging.coralogix.net/mgmt/testing/tools/httpbin/post/"),
PagerDuty: &webhooks.PagerDutyConfig{
ServiceKey: webhooks.PtrString("example-key"),
},
Expand All @@ -186,7 +186,7 @@ func TestWebhooks(t *testing.T) {
&webhooks.OutgoingWebhookInputDataEmailGroup{
Name: webhooks.PtrString("email-group-webhook"),
Type: webhooks.WEBHOOKTYPE_EMAIL_GROUP.Ptr(),
Url: webhooks.PtrString("https://example-url.com/"),
Url: webhooks.PtrString("https://api.staging.coralogix.net/mgmt/testing/tools/httpbin/post/"),
EmailGroup: &webhooks.EmailGroupConfig{
EmailAddresses: []string{"user@example.com"}},
},
Expand Down Expand Up @@ -214,7 +214,7 @@ func TestWebhooks(t *testing.T) {
&webhooks.OutgoingWebhookInputDataOpsgenie{
Name: webhooks.PtrString("opsgenie-webhook"),
Type: webhooks.WEBHOOKTYPE_OPSGENIE.Ptr(),
Url: webhooks.PtrString("https://example.opsgenie.com"),
Url: webhooks.PtrString("https://api.opsgenie.com"),
Opsgenie: map[string]interface{}{},
},
),
Expand Down
35 changes: 35 additions & 0 deletions go/openapi/tests/actions_list_read_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package tests

import (
"context"
"testing"

"github.com/stretchr/testify/require"

"github.com/coralogix/coralogix-management-sdk/go/openapi/cxsdk"
)

func TestActionsListRead(t *testing.T) {
cfg := cxsdk.NewConfigBuilder().WithAPIKeyEnv().WithRegionEnv().Build()
client := cxsdk.NewActionsClient(cfg)

listResp, httpResp, err := client.
ActionsServiceListActions(context.Background()).
Execute()
require.NoError(t, cxsdk.NewAPIError(httpResp, err))

if len(listResp.Actions) == 0 {
t.Skip("no resources to read")
}

actionID := listResp.Actions[0].GetId()
if actionID == "" {
t.Skip("no resources to read")
}

getResp, httpResp, err := client.
ActionsServiceGetAction(context.Background(), actionID).
Execute()
require.NoError(t, cxsdk.NewAPIError(httpResp, err))
require.Equal(t, actionID, getResp.GetAction().Id)
}
35 changes: 35 additions & 0 deletions go/openapi/tests/alerts_list_read_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package tests

import (
"context"
"testing"

"github.com/stretchr/testify/require"

"github.com/coralogix/coralogix-management-sdk/go/openapi/cxsdk"
)

func TestAlertsListRead(t *testing.T) {
cfg := cxsdk.NewConfigBuilder().WithAPIKeyEnv().WithRegionEnv().Build()
client := cxsdk.NewAlertsClient(cfg)

listResp, httpResp, err := client.
AlertDefsServiceListAlertDefs(context.Background()).
Execute()
require.NoError(t, cxsdk.NewAPIError(httpResp, err))

if len(listResp.AlertDefs) == 0 {
t.Skip("no resources to read")
}

alertID := listResp.AlertDefs[0].GetId()
if alertID == "" {
t.Skip("no resources to read")
}

getResp, httpResp, err := client.
AlertDefsServiceGetAlertDef(context.Background(), alertID).
Execute()
require.NoError(t, cxsdk.NewAPIError(httpResp, err))
require.Equal(t, alertID, *getResp.GetAlertDef().Id)
}
35 changes: 35 additions & 0 deletions go/openapi/tests/api_keys_list_read_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package tests

import (
"context"
"testing"

"github.com/stretchr/testify/require"

"github.com/coralogix/coralogix-management-sdk/go/openapi/cxsdk"
)

func TestAPIKeysListRead(t *testing.T) {
cfg := cxsdk.NewConfigBuilder().WithAPIKeyEnv().WithRegionEnv().Build()
client := cxsdk.NewAPIKeysClient(cfg)

listResp, httpResp, err := client.
ApiKeysServiceGetSendDataApiKeys(context.Background()).
Execute()
require.NoError(t, cxsdk.NewAPIError(httpResp, err))

if len(listResp.Keys) == 0 {
t.Skip("no resources to read")
}

keyID := listResp.Keys[0].GetId()
if keyID == "" {
t.Skip("no resources to read")
}

getResp, httpResp, err := client.
ApiKeysServiceGetApiKey(context.Background(), keyID).
Execute()
require.NoError(t, cxsdk.NewAPIError(httpResp, err))
require.Equal(t, keyID, *getResp.GetKeyInfo().Id)
}
35 changes: 35 additions & 0 deletions go/openapi/tests/archive_logs_list_read_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package tests

import (
"context"
"reflect"
"testing"

"github.com/stretchr/testify/require"

"github.com/coralogix/coralogix-management-sdk/go/openapi/cxsdk"
)

func TestArchiveLogsListRead(t *testing.T) {
cfg := cxsdk.NewConfigBuilder().WithAPIKeyEnv().WithRegionEnv().Build()
client := cxsdk.NewArchiveLogsClient(cfg)

listResp, httpResp, err := client.
S3TargetServiceGetTarget(context.Background()).
Execute()
require.NoError(t, cxsdk.NewAPIError(httpResp, err))

listTarget := listResp.Target.GetActualInstance()
if listTarget == nil {
t.Skip("no resources to read")
}

getResp, httpResp, err := client.
S3TargetServiceGetTarget(context.Background()).
Execute()
require.NoError(t, cxsdk.NewAPIError(httpResp, err))

getTarget := getResp.Target.GetActualInstance()
require.NotNil(t, getTarget)
require.Equal(t, reflect.TypeOf(listTarget), reflect.TypeOf(getTarget))
}
Loading
Loading