Skip to content

Commit

Permalink
resolve part of test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Oct 20, 2023
1 parent bf9c207 commit 92ab293
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 1,952 deletions.
143 changes: 0 additions & 143 deletions cmd/agentk/agentkapp/api_test.go

This file was deleted.

11 changes: 2 additions & 9 deletions cmd/kas/kasapp/agent_rpc_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ import (
"github.com/getsentry/sentry-go"
"github.com/stretchr/testify/assert"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/api"
gapi "gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/gitlab/api"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/module/modserver"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/module/modshared"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/tool/cache"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/tool/errz"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/tool/testing/mock_cache"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/tool/testing/mock_gitlab"
"gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/internal/tool/testing/testhelpers"
"go.opentelemetry.io/otel/trace"
"go.uber.org/mock/gomock"
Expand Down Expand Up @@ -133,10 +131,6 @@ func setupAgentRpcApi(t *testing.T, statusCode int) (context.Context, *zap.Logge
hub := NewMockSentryHub(ctrl)
errCacher := mock_cache.NewMockErrCacher[api.AgentToken](ctrl)
ctx, traceId := testhelpers.CtxWithSpanContext(t)
gitLabClient := mock_gitlab.SetupClient(t, gapi.AgentInfoApiPath, func(w http.ResponseWriter, r *http.Request) {
testhelpers.AssertGetJsonRequestIsCorrect(t, r, traceId)
w.WriteHeader(statusCode)
})
sra := &serverRpcApi{
RpcApiStub: modshared.RpcApiStub{
Logger: log,
Expand All @@ -150,9 +144,8 @@ func setupAgentRpcApi(t *testing.T, statusCode int) (context.Context, *zap.Logge
sra.sentryHub = hub

rpcApi := &serverAgentRpcApi{
RpcApi: sra,
Token: testhelpers.AgentkToken,
GitLabClient: gitLabClient,
RpcApi: sra,
Token: testhelpers.AgentkToken,
AgentInfoCache: cache.NewWithError[api.AgentToken, *api.AgentInfo](0, 0, errCacher,
trace.NewNoopTracerProvider().Tracer(kasTracerName),
func(err error) bool { return false }), // no cache!
Expand Down
Loading

0 comments on commit 92ab293

Please sign in to comment.