Skip to content

Commit

Permalink
Merge pull request #104 from gianlucam76/prep
Browse files Browse the repository at this point in the history
Fix expiration time test
  • Loading branch information
gianlucam76 authored Jul 21, 2023
2 parents 07e3eed + 9cd48a2 commit 7117b66
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 10 additions & 4 deletions controllers/deployer_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,17 @@ var _ = Describe("Deployer utils", func() {
[]byte(randomString()), &tokenRequest.Status, klogr.New())).To(Succeed())

// Wait for cache to sync
Eventually(func() error {
_, err := controllers.GetSecretWithKubeconfig(context.TODO(),
Eventually(func() bool {
secret, err := controllers.GetSecretWithKubeconfig(context.TODO(),
testEnv.Client, roleRequest, clusterNamespace, clusterName, libsveltosv1alpha1.ClusterTypeSveltos, klogr.New())
return err
}, timeout, pollingInterval).Should(BeNil())
if err != nil || secret.Data == nil {
return false
}
// Since Secret is first created and then updated with expirationKey
// verify expirationKey is set. Then validate value out of this eventual loop
_, ok := secret.Data[controllers.ExpirationKey]
return ok
}, timeout, pollingInterval).Should(BeTrue())

// Since expiration time was set in a day, expect result to be false
Expect(controllers.IsTimeExpired(context.TODO(), testEnv.Client, roleRequest,
Expand Down
4 changes: 4 additions & 0 deletions controllers/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ var (
GetSecretWithKubeconfig = getSecretWithKubeconfig
)

const (
ExpirationKey = expirationKey
)

var (
DeployRoleRequestInCluster = deployRoleRequestInCluster
UndeployRoleRequestFromCluster = undeployRoleRequestFromCluster
Expand Down

0 comments on commit 7117b66

Please sign in to comment.