Skip to content

Commit

Permalink
fix: Fix tests and controller client creation
Browse files Browse the repository at this point in the history
  • Loading branch information
codablock committed Jun 9, 2023
1 parent f104e32 commit cb7a74f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions cmd/kluctl/commands/cmd_controller_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ func (cmd *controllerRunCmd) Run(ctx context.Context) error {
}

if cmd.WriteCommandResult {
wc, ok := mgr.GetClient().(client.WithWatch)
if !ok {
return fmt.Errorf("client does not implement WithWatch")
c, err := client.NewWithWatch(restConfig, client.Options{})
if err != nil {
return err
}
resultStore, err := results.NewResultStoreSecrets(ctx, wc, cmd.CommandResultNamespace, cmd.KeepCommandResultsCount)
resultStore, err := results.NewResultStoreSecrets(ctx, c, cmd.CommandResultNamespace, cmd.KeepCommandResultsCount)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/gitops_errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (suite *GitopsTestSuite) assertErrors(key client.ObjectKey, rstatus metav1.
g.Expect(readinessCondition.Reason).To(Equal(rreason))
g.Expect(readinessCondition.Message).To(ContainSubstring(rmessage))

rs, err := results.NewResultStoreSecrets(context.TODO(), suite.k.Client, nil, "", 0)
rs, err := results.NewResultStoreSecrets(context.TODO(), suite.k.Client, "", 0)
g.Expect(err).To(Succeed())

lastDeployResult, err := kd.Status.GetLastDeployResult()
Expand Down
2 changes: 1 addition & 1 deletion e2e/results_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestWriteResult(t *testing.T) {
p.KluctlMust("deploy", "--yes", "-t", "test", "--write-command-result")
assertConfigMapExists(t, k, p.TestSlug(), "cm")

rs, err := results.NewResultStoreSecrets(context.Background(), k.Client, nil, "kluctl-results", 0)
rs, err := results.NewResultStoreSecrets(context.Background(), k.Client, "kluctl-results", 0)
assert.NoError(t, err)

opts := results.ListCommandResultSummariesOptions{
Expand Down
4 changes: 2 additions & 2 deletions e2e/test-utils/envtest_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type EnvTestCluster struct {

HttpClient *http.Client
DynamicClient dynamic.Interface
Client client.Client
Client client.WithWatch
ServerVersion *version.Info

callbackServer webhook.Server
Expand Down Expand Up @@ -103,7 +103,7 @@ func (k *EnvTestCluster) Start() error {
}
k.DynamicClient = dynamicClient

c, err := client.New(k.config, client.Options{
c, err := client.NewWithWatch(k.config, client.Options{
HTTPClient: httpClient,
Scheme: k.env.Scheme,
})
Expand Down

0 comments on commit cb7a74f

Please sign in to comment.