Skip to content

Commit

Permalink
fix wait
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinAbro321 committed Jun 27, 2024
1 parent d4c2454 commit 8fdfa85
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
4 changes: 0 additions & 4 deletions src/test/external/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ import (

var zarfBinPath = path.Join("../../../build", test.GetCLIName())

func verifyKubectlWaitSuccess(t *testing.T, timeoutMinutes time.Duration, args []string, onTimeout string) bool {
return verifyWaitSuccess(t, timeoutMinutes, "kubectl", args, "condition met", onTimeout)
}

func createPodInfoPackageWithInsecureSources(t *testing.T, temp string) {
err := copy.Copy("../../../examples/podinfo-flux", temp)
require.NoError(t, err)
Expand Down
49 changes: 32 additions & 17 deletions src/test/external/ext_in_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,23 +154,38 @@ func (suite *ExtInClusterTestSuite) Test_1_Deploy() {
err = exec.CmdWithPrint(zarfBinPath, deployArgs...)
suite.NoError(err, "unable to deploy flux example package")

// Verify flux was able to pull from the 'external' git repository
podinfoWaitCmd := []string{"wait", "deployment", "-n=podinfo-git", "podinfo", "--for", "condition=Available=True", "--timeout=3s"}
errorStr := "unable to verify flux (git) deployed the podinfo example"
success := verifyKubectlWaitSuccess(suite.T(), 2, podinfoWaitCmd, errorStr)
suite.True(success, errorStr)

// Verify flux was able to pull from the 'external' helm repository
podinfoWaitCmd = []string{"wait", "deployment", "-n=podinfo-helm", "podinfo", "--for", "condition=Available=True", "--timeout=3s"}
errorStr = "unable to verify flux (helm) deployed the podinfo example"
success = verifyKubectlWaitSuccess(suite.T(), 2, podinfoWaitCmd, errorStr)
suite.True(success, errorStr)

// Verify flux was able to pull from the 'external' oci repository
podinfoWaitCmd = []string{"wait", "deployment", "-n=podinfo-oci", "podinfo", "--for", "condition=Available=True", "--timeout=3s"}
errorStr = "unable to verify flux (oci) deployed the podinfo example"
success = verifyKubectlWaitSuccess(suite.T(), 2, podinfoWaitCmd, errorStr)
suite.True(success, errorStr)
c, err := cluster.NewCluster()
suite.NoError(err)
objs := []object.ObjMetadata{
{
GroupKind: schema.GroupKind{
Group: "apps",
Kind: "Deployment",
},
Namespace: "podinfo-git",
Name: "podinfo",
},
{
GroupKind: schema.GroupKind{
Group: "apps",
Kind: "Deployment",
},
Namespace: "podinfo-helm",
Name: "podinfo",
},
{
GroupKind: schema.GroupKind{
Group: "apps",
Kind: "Deployment",
},
Namespace: "podinfo-oci",
Name: "podinfo",
},
}
waitCtx, waitCancel := context.WithTimeout(context.Background(), 60*time.Second)
defer waitCancel()
err = pkgkubernetes.WaitForReady(waitCtx, c.Watcher, objs)
suite.NoError(err)

_, _, err = exec.CmdWithContext(context.TODO(), exec.PrintCfg(), zarfBinPath, "destroy", "--confirm")
suite.NoError(err, "unable to teardown zarf")
Expand Down

0 comments on commit 8fdfa85

Please sign in to comment.