From e014cf28858556beba3668edec8fbe224a90ab89 Mon Sep 17 00:00:00 2001 From: Daniel Panzella Date: Mon, 9 Sep 2024 10:14:10 -0700 Subject: [PATCH] fix: cleanup struct and names --- main.go | 2 +- pkg/wandb/spec/channel/deployer/deployer.go | 7 +++---- pkg/wandb/spec/channel/deployer/deployer_test.go | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index 0dadd35..f13b427 100644 --- a/main.go +++ b/main.go @@ -119,7 +119,7 @@ func main() { Recorder: mgr.GetEventRecorderFor("weightsandbiases"), Client: mgr.GetClient(), Scheme: mgr.GetScheme(), - DeployerClient: &deployer.DeployerClient{DeployerChannelUrl: deployerAPI}, + DeployerClient: &deployer.DeployerClient{DeployerAPI: deployerAPI}, Debug: debug, }).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "WeightsAndBiases") diff --git a/pkg/wandb/spec/channel/deployer/deployer.go b/pkg/wandb/spec/channel/deployer/deployer.go index 32e8eb5..918cef9 100644 --- a/pkg/wandb/spec/channel/deployer/deployer.go +++ b/pkg/wandb/spec/channel/deployer/deployer.go @@ -33,8 +33,7 @@ type DeployerInterface interface { } type DeployerClient struct { - DeployerChannelUrl string - DeployerReleaseURL string + DeployerAPI string } type SpecUnknownChart struct { @@ -45,8 +44,8 @@ type SpecUnknownChart struct { func (c *DeployerClient) getDeployerURL(opts GetSpecOptions) string { var url string - if c.DeployerChannelUrl != "" { - url = c.DeployerChannelUrl + if c.DeployerAPI != "" { + url = c.DeployerAPI } else { url = DeployerAPI } diff --git a/pkg/wandb/spec/channel/deployer/deployer_test.go b/pkg/wandb/spec/channel/deployer/deployer_test.go index a81cd64..f69a996 100644 --- a/pkg/wandb/spec/channel/deployer/deployer_test.go +++ b/pkg/wandb/spec/channel/deployer/deployer_test.go @@ -66,7 +66,7 @@ func TestDeployerClient_GetSpec(t *testing.T) { server := tt.fields.testServer(tt.args.license) defer server.Close() c := &DeployerClient{ - DeployerChannelUrl: server.URL, + DeployerAPI: server.URL, } got, err := c.GetSpec(GetSpecOptions{ License: tt.args.license, @@ -122,8 +122,7 @@ func TestDeployerClient_getDeployerURL(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { c := &DeployerClient{ - DeployerChannelUrl: tt.deployerChannelUrl, - DeployerReleaseURL: tt.deployerReleaseURL, + DeployerAPI: tt.deployerChannelUrl, } got := c.getDeployerURL(GetSpecOptions{ReleaseId: tt.releaseId}) if got != tt.want {