Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions test/e2e/ctrcfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func runTestWithCtrcfg(t *testing.T, testName, regexKey, expectedConfValue strin
err := cs.MachineConfigs().Delete(context.TODO(), oldMCConfig.Name, metav1.DeleteOptions{})
require.Nil(t, err, "machine config deletion failed")
})
waitForConfigAndPoolComplete(t, cs, poolName, oldMCConfig.Name)
lastTarget := waitForConfigAndPoolComplete(t, cs, poolName, oldMCConfig.Name)

// create our ctrcfg and attach it to our created node pool
cleanupCtrcfgFunc := createCtrcfgWithConfig(t, cs, ctrcfgName, poolName, cfg)
Expand All @@ -103,14 +103,10 @@ func runTestWithCtrcfg(t *testing.T, testName, regexKey, expectedConfValue strin
// cleanup ctrcfg and make sure it doesn't error
err = cleanupCtrcfgFunc()
require.Nil(t, err)

t.Logf("Deleted ContainerRuntimeConfig %s", ctrcfgName)
// there's a weird race where we observe the pool is updated when in reality
// that update is from before. Sleeping allows a new update cycle to start
time.Sleep(time.Second * 5)

// ensure config rolls back as expected
waitForConfigAndPoolComplete(t, cs, poolName, oldMCConfig.Name)
waitForPoolComplete(t, cs, poolName, lastTarget)

restoredConfValue := getValueFromCrioConfig(t, cs, node, regexKey, defaultPath)
require.Equal(t, restoredConfValue, oldConfValue, "ctrcfg deletion didn't cause node to roll back config")
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ func getMcName(t *testing.T, cs *framework.ClientSet, poolName string) string {
return mcp.Status.Configuration.Name
}

// waitForConfigAndPoolComplete is a helper function that gets a renderedConfig and waits for its pool to complete
func waitForConfigAndPoolComplete(t *testing.T, cs *framework.ClientSet, pool, mcName string) {
// waitForConfigAndPoolComplete is a helper function that gets a renderedConfig and waits for its pool to complete.
// The return value is the final rendered config.
func waitForConfigAndPoolComplete(t *testing.T, cs *framework.ClientSet, pool, mcName string) string {
config, err := waitForRenderedConfig(t, cs, pool, mcName)
require.Nil(t, err, "failed to render machine config %s from pool %s", mcName, pool)
err = waitForPoolComplete(t, cs, pool, config)
require.Nil(t, err, "pool %s did not update to config %s", pool, config)
return config
}

// waitForRenderedConfig polls a MachineConfigPool until it has
Expand Down