Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
Signed-off-by: Hang Yan <yhang@vmware.com>
  • Loading branch information
hangyan committed Nov 5, 2024
1 parent 85cd494 commit 267b8d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions pkg/controller/supportbundlecollection/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,17 @@ func (c *Controller) createInternalSupportBundleCollection(bundle *v1alpha1.Supp
klog.ErrorS(err, "Failed to get authentication defined in the SupportBundleCollection CR", "name", bundle.Name, "authentication", bundle.Spec.Authentication)
return nil, err
}
internalBundleCollection := c.addInternalSupportBundleCollection(bundle, nodeSpan, &controlplane.BundleServerAuthConfiguration{
bundleAuthConfig := &controlplane.BundleServerAuthConfiguration{
BearerToken: authentication.BearerToken,
APIKey: authentication.APIKey,
BasicAuthentication: &controlplane.BasicAuthentication{
}
if authentication.BasicAuthentication != nil {
bundleAuthConfig.BasicAuthentication = &controlplane.BasicAuthentication{
Username: authentication.BasicAuthentication.Username,
Password: authentication.BasicAuthentication.Password,
},
}, metav1.NewTime(expiredAt))
}
}
internalBundleCollection := c.addInternalSupportBundleCollection(bundle, nodeSpan, bundleAuthConfig, metav1.NewTime(expiredAt))
// Process the support bundle collection when time is up, this will create a CollectionFailure condition if the
// bundle collection is not completed in time because any Agent fails to upload the files and does not report
// the failure.
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/ftp/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type AuthConfiguration struct {
AuthType AuthType
BearerToken string
APIKey string
BasicAuthentication BasicAuthentication
BasicAuthentication *BasicAuthentication
}

// GenSSHClientConfig generates ssh.ClientConfig from username and password
Expand Down Expand Up @@ -112,7 +112,7 @@ func GetAuthConfigurationFromSecret(ctx context.Context, authType AuthType, secr
}
return &AuthConfiguration{
AuthType: BasicAuthenticationType,
BasicAuthentication: BasicAuthentication{
BasicAuthentication: &BasicAuthentication{
Username: username,
Password: password,
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/ftp/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestParseFileServerAuth(t *testing.T) {
},
expectedAuth: &AuthConfiguration{
AuthType: BasicAuthenticationType,
BasicAuthentication: BasicAuthentication{
BasicAuthentication: &BasicAuthentication{
Username: usr,
Password: pwd,
},
Expand Down

0 comments on commit 267b8d6

Please sign in to comment.