From 98cebe04d68b80eb752c313cb175ecff5feea2de Mon Sep 17 00:00:00 2001 From: kuritka Date: Fri, 20 Jan 2023 12:46:26 +0200 Subject: [PATCH] ordered #1 --- .../fo_lifecycle_3_clusters_ordered_test.go | 22 ++++++++++++++++++- .../test/resources/ingress_fo3_ordered1.yaml | 2 +- .../test/resources/ingress_fo3_ordered2.yaml | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/terratest/test/fo_lifecycle_3_clusters_ordered_test.go b/terratest/test/fo_lifecycle_3_clusters_ordered_test.go index c614e7b..649988c 100644 --- a/terratest/test/fo_lifecycle_3_clusters_ordered_test.go +++ b/terratest/test/fo_lifecycle_3_clusters_ordered_test.go @@ -30,7 +30,7 @@ Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic func TestFailoverLifecycleOnThreeClustersOrdered(t *testing.T) { const ingressPath1 = "./resources/ingress_fo3_ordered1.yaml" // const ingressPath2 = "./resources/ingress_fo3_ordered2.yaml" - // const digHits = 10 + const digHits = 10 // const wgetHits = 8 instanceEU, err := utils.NewWorkflow(t, terratest.Environment.EUCluster, terratest.Environment.EUClusterPort). WithIngress(ingressPath1). @@ -71,4 +71,24 @@ func TestFailoverLifecycleOnThreeClustersOrdered(t *testing.T) { terratest.Environment.USCluster, terratest.Environment.ZACluster) + t.Run("πŸ‡ΊπŸ‡Έ Digging US,EU,ZA cluster, IPs of US are returned", func(t *testing.T) { + usClusterIPs := instanceUS.GetInfo().NodeIPs + ips := instanceEU.Tools().DigNCoreDNSAll(digHits) + require.True(t, utils.MapHasOnlyKeys(ips, usClusterIPs...)) + ips = instanceUS.Tools().DigNCoreDNSAll(digHits) + require.True(t, utils.MapHasOnlyKeys(ips, usClusterIPs...)) + ips = instanceZA.Tools().DigNCoreDNSAll(digHits) + require.True(t, utils.MapHasOnlyKeys(ips, usClusterIPs...)) + }) + + t.Run("πŸ’€πŸ‡ΊπŸ‡Έ Killing namespace on Primary US cluster", func(t *testing.T) { + zaClusterIPs := instanceZA.GetInfo().NodeIPs + instanceUS.Kill() + err = instanceEU.Resources().WaitUntilDNSEndpointContainsTargets(instanceEU.GetInfo().Host, zaClusterIPs) + require.NoError(t, err, "WARNING: If you running test locally, ensure the App with same host IS NOT running in forgotten namespaces") + err = instanceUS.Resources().WaitUntilDNSEndpointContainsTargets(instanceUS.GetInfo().Host, zaClusterIPs) + require.NoError(t, err, "WARNING: If you running test locally, ensure the App with same host IS NOT running in forgotten namespaces") + err = instanceZA.Resources().WaitUntilDNSEndpointContainsTargets(instanceZA.GetInfo().Host, zaClusterIPs) + require.NoError(t, err, "WARNING: If you running test locally, ensure the App with same host IS NOT running in forgotten namespaces") + }) } diff --git a/terratest/test/resources/ingress_fo3_ordered1.yaml b/terratest/test/resources/ingress_fo3_ordered1.yaml index dd623e3..e7d4a96 100644 --- a/terratest/test/resources/ingress_fo3_ordered1.yaml +++ b/terratest/test/resources/ingress_fo3_ordered1.yaml @@ -8,7 +8,7 @@ metadata: spec: ingressClassName: nginx rules: - - host: terratest-fo-3.cloud.example.com + - host: terratest-fo-3-ordered1.cloud.example.com http: paths: - backend: diff --git a/terratest/test/resources/ingress_fo3_ordered2.yaml b/terratest/test/resources/ingress_fo3_ordered2.yaml index d87bf29..5cdb66a 100644 --- a/terratest/test/resources/ingress_fo3_ordered2.yaml +++ b/terratest/test/resources/ingress_fo3_ordered2.yaml @@ -8,7 +8,7 @@ metadata: spec: ingressClassName: nginx rules: - - host: terratest-fo-3.cloud.example.com + - host: terratest-fo-3-ordered2.cloud.example.com http: paths: - backend: