Skip to content

Commit

Permalink
fix: cleanup struct and names
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpanzella committed Sep 9, 2024
1 parent d73b060 commit e014cf2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
7 changes: 3 additions & 4 deletions pkg/wandb/spec/channel/deployer/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ type DeployerInterface interface {
}

type DeployerClient struct {
DeployerChannelUrl string
DeployerReleaseURL string
DeployerAPI string
}

type SpecUnknownChart struct {
Expand All @@ -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
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/wandb/spec/channel/deployer/deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e014cf2

Please sign in to comment.