From 062df4413a495711ce2ec5e11b7d1854b2a22e1d Mon Sep 17 00:00:00 2001 From: Loren Yu Date: Thu, 14 Dec 2023 10:43:27 -0800 Subject: [PATCH] Test feature flag endpoint in CI (#512) * Hit feature-flags endpoint in example app during CI Infra service tests * Hit feature-flags endpoint in example app during Template only CI Infra tests ## Context [This commit](https://github.com/navapbc/template-infra/commit/8bfab4387277bb7789d1aebc062bb3f6ba9a1e1d) broke the feature flag evidently integration (fixed now) but it was not caught as part of any automated testing. This change adds a ping to the feature-flags endpoint which integrates with Evidently to catch future regressions. --- infra/test/infra_test.go | 5 +++++ template-only-test/template_infra_test.go | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/infra/test/infra_test.go b/infra/test/infra_test.go index a62219d6..00e7749b 100644 --- a/infra/test/infra_test.go +++ b/infra/test/infra_test.go @@ -99,6 +99,11 @@ func RunEndToEndTests(t *testing.T, terraformOptions *terraform.Options) { http_helper.HttpGetWithRetryWithCustomValidation(t, serviceEndpoint, nil, 5, 1*time.Second, func(responseStatus int, responseBody string) bool { return responseStatus == 200 }) + // Hit feature flags endpoint to make sure Evidently integration is working + featureFlagsEndpoint := fmt.Sprintf("%s/feature-flags", serviceEndpoint) + http_helper.HttpGetWithRetryWithCustomValidation(t, featureFlagsEndpoint, nil, 5, 1*time.Second, func(responseStatus int, responseBody string) bool { + return responseStatus == 200 + }) fmt.Println("::endgroup::") } diff --git a/template-only-test/template_infra_test.go b/template-only-test/template_infra_test.go index f9ef72c5..1d30b1f2 100644 --- a/template-only-test/template_infra_test.go +++ b/template-only-test/template_infra_test.go @@ -197,6 +197,13 @@ func ValidateDevEnvironment(t *testing.T) { http_helper.HttpGetWithRetryWithCustomValidation(t, serviceEndpoint, nil, 10, 3*time.Second, func(responseStatus int, responseBody string) bool { return responseStatus == 200 }) + + // Hit feature flags endpoint to make sure Evidently integration is working + featureFlagsEndpoint := fmt.Sprintf("%s/feature-flags", serviceEndpoint) + http_helper.HttpGetWithRetryWithCustomValidation(t, featureFlagsEndpoint, nil, 10, 3*time.Second, func(responseStatus int, responseBody string) bool { + return responseStatus == 200 + }) + fmt.Println("::endgroup::") }