Skip to content

Commit

Permalink
chore: remove getters for ClientSet
Browse files Browse the repository at this point in the history
  • Loading branch information
jskelin committed Dec 9, 2024
1 parent 533fe77 commit 8b95ab4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cmd/monaco/download/download_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func downloadConfigs(clientSet *client.ClientSet, apisToDownload api.APIs, opts
if shouldDownloadDocuments(opts) {
if opts.auth.OAuth != nil {
log.Info("Downloading documents")
documentCfgs, err := fn.documentDownload(clientSet.Document(), opts.projectName)
documentCfgs, err := fn.documentDownload(clientSet.DocumentClient, opts.projectName)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/monaco/integrationtest/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func AssertAllConfigsAvailability(t *testing.T, fs afero.Fs, manifestPath string
}
foundID = AssertBucket(t, clients.Bucket(), env, available, theConfig)
case config.DocumentType:
if clients.Document() == nil {
if clients.DocumentClient == nil {
t.Errorf("can not assert existience of Document config %q) because no DocumentClient exists - was the test env not configured as Platform?", theConfig.Coordinate)
return
}
Expand Down
20 changes: 11 additions & 9 deletions cmd/monaco/integrationtest/v2/documents_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ package v2
import (
"context"
"fmt"
"path/filepath"
"strings"
"testing"

"github.com/spf13/afero"
"github.com/stretchr/testify/assert"

"github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/integrationtest"
"github.com/dynatrace/dynatrace-configuration-as-code/v2/cmd/monaco/integrationtest/utils/monaco"
"github.com/dynatrace/dynatrace-configuration-as-code/v2/internal/featureflags"
manifestloader "github.com/dynatrace/dynatrace-configuration-as-code/v2/pkg/manifest/loader"
"github.com/spf13/afero"
"github.com/stretchr/testify/assert"
"path/filepath"
"strings"
"testing"
)

// TestDocuments verifies that the "private" field of a document config definition in the config.yaml file
Expand Down Expand Up @@ -63,13 +65,13 @@ func TestDocuments(t *testing.T) {

// check isPrivate == false
clientSet := integrationtest.CreateDynatraceClients(t, man.Environments[environment])
result, err := clientSet.Document().List(context.TODO(), fmt.Sprintf("name='my-notebook_%s'", testContext.suffix))
result, err := clientSet.DocumentClient.List(context.TODO(), fmt.Sprintf("name='my-notebook_%s'", testContext.suffix))
assert.NoError(t, err)
assert.Len(t, result.Responses, 1)
assert.False(t, result.Responses[0].IsPrivate)

// check isPrivate == true
result, err = clientSet.Document().List(context.TODO(), fmt.Sprintf("name='my-dashboard_%s'", testContext.suffix))
result, err = clientSet.DocumentClient.List(context.TODO(), fmt.Sprintf("name='my-dashboard_%s'", testContext.suffix))
assert.NoError(t, err)
assert.Len(t, result.Responses, 1)
assert.True(t, result.Responses[0].IsPrivate)
Expand Down Expand Up @@ -101,13 +103,13 @@ func TestDocuments(t *testing.T) {
assert.NoError(t, err)

// check if isPrivate was changed to true
result, err = clientSet.Document().List(context.TODO(), fmt.Sprintf("name='my-notebook_%s'", testContext.suffix))
result, err = clientSet.DocumentClient.List(context.TODO(), fmt.Sprintf("name='my-notebook_%s'", testContext.suffix))
assert.NoError(t, err)
assert.Len(t, result.Responses, 1)
assert.True(t, result.Responses[0].IsPrivate)

// check if isPrivate was changed to false
result, err = clientSet.Document().List(context.TODO(), fmt.Sprintf("name='my-dashboard_%s'", testContext.suffix))
result, err = clientSet.DocumentClient.List(context.TODO(), fmt.Sprintf("name='my-dashboard_%s'", testContext.suffix))
assert.NoError(t, err)
assert.Len(t, result.Responses, 1)
assert.False(t, result.Responses[0].IsPrivate)
Expand Down
8 changes: 0 additions & 8 deletions pkg/client/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,6 @@ func (s ClientSet) Bucket() BucketClient {
return s.BucketClient
}

func (s ClientSet) Document() DocumentClient {
return s.DocumentClient
}

func (s ClientSet) OpenPipeline() OpenPipelineClient {
return s.OpenPipelineClient
}

type ClientOptions struct {
CustomUserAgent string
SupportArchive bool
Expand Down

0 comments on commit 8b95ab4

Please sign in to comment.