From ee7e88e920fd05de4e21cfecaf8ef044b8b50b97 Mon Sep 17 00:00:00 2001 From: Moshe Immermam Date: Sun, 17 Nov 2024 00:00:45 +0200 Subject: [PATCH] chore: fix file path --- pkg/health/health_test.go | 9 ++++++++- .../{AWS::ECS::Task => AWS/ECS/Task}/failed.yaml | 0 .../Application}/degraded.yaml | 0 .../ContainerCluster}/failed.yaml | 0 4 files changed, 8 insertions(+), 1 deletion(-) rename pkg/health/testdata/{AWS::ECS::Task => AWS/ECS/Task}/failed.yaml (100%) rename pkg/health/testdata/{Kubernetes::Application => Kubernetes/Application}/degraded.yaml (100%) rename pkg/health/testdata/{Kubernetes::ContainerCluster => Kubernetes/ContainerCluster}/failed.yaml (100%) diff --git a/pkg/health/health_test.go b/pkg/health/health_test.go index f0b9d14..6eb9dba 100644 --- a/pkg/health/health_test.go +++ b/pkg/health/health_test.go @@ -139,7 +139,14 @@ func getHealthStatus(yamlPath string, t *testing.T, overwrites map[string]string if !strings.HasPrefix(yamlPath, "./testdata/") && !strings.HasPrefix(yamlPath, "../resource_customizations") { yamlPath = "./testdata/" + yamlPath } - yamlBytes, err := os.ReadFile(yamlPath) + var yamlBytes []byte + var err error + + if strings.Contains(yamlPath, "::") { + yamlBytes, err = os.ReadFile(strings.ReplaceAll(yamlPath, "::", "/")) + } else { + yamlBytes, err = os.ReadFile(yamlPath) + } require.NoError(t, err) yamlString := string(yamlBytes) diff --git a/pkg/health/testdata/AWS::ECS::Task/failed.yaml b/pkg/health/testdata/AWS/ECS/Task/failed.yaml similarity index 100% rename from pkg/health/testdata/AWS::ECS::Task/failed.yaml rename to pkg/health/testdata/AWS/ECS/Task/failed.yaml diff --git a/pkg/health/testdata/Kubernetes::Application/degraded.yaml b/pkg/health/testdata/Kubernetes/Application/degraded.yaml similarity index 100% rename from pkg/health/testdata/Kubernetes::Application/degraded.yaml rename to pkg/health/testdata/Kubernetes/Application/degraded.yaml diff --git a/pkg/health/testdata/Kubernetes::ContainerCluster/failed.yaml b/pkg/health/testdata/Kubernetes/ContainerCluster/failed.yaml similarity index 100% rename from pkg/health/testdata/Kubernetes::ContainerCluster/failed.yaml rename to pkg/health/testdata/Kubernetes/ContainerCluster/failed.yaml