diff --git a/tests/pr_test.go b/tests/pr_test.go index 386e3bce7..e320f3d88 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -221,6 +221,7 @@ func TestRunRoksPattern(t *testing.T) { } options := setupOptionsRoksPattern(t, "ocp") + options.PostApplyHook = getClusterIngress output, err := options.RunTestConsistency() assert.Nil(t, err, "This should not have errored") @@ -239,6 +240,25 @@ func TestRunUpgradeRoksPattern(t *testing.T) { } } +func getClusterIngress(options *testhelper.TestOptions) error { + + // Get output of the last apply + outputs, outputErr := terraform.OutputAllE(options.Testing, options.TerraformOptions) + if assert.Error(options.Testing, outputErr, "error getting last terraform apply outputs: %s", outputErr) { + return nil + } + + // Validate that the "cluster_name" key is present in the outputs + expectedOutputs := []string{"cluster_name"} + _, ValidationErr := testhelper.ValidateTerraformOutputs(outputs, expectedOutputs...) + + // Proceed with the cluster ingress health check if "cluster_name" is valid + if assert.NoErrorf(options.Testing, ValidationErr, "Some outputs not found or nil: %s", ValidationErr) { + options.CheckClusterIngressHealthyDefaultTimeout(outputs["cluster_name"].(string)) + } + return nil +} + func setupOptionsVsiPattern(t *testing.T, prefix string) *testhelper.TestOptions { sshPublicKey := sshPublicKey(t)