Skip to content

Commit

Permalink
Fix ATS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uvegla committed Nov 22, 2024
1 parent a963cc7 commit 27b8e71
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/ats/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,13 @@ func TestMetrics(t *testing.T) {

t.Logf("Waiting for test-app to come up...")

_, err = waitForPod(ctx, k8sClients, "test-app", "test-app")
testAppPodName, err := waitForPod(ctx, k8sClients, "test-app", "test-app")
if err != nil {
t.Fatalf("could not get test-app pod %#v", err)
}

t.Logf("Waited for test-app to come up: %s", testAppPodName)

var fw *k8sportforward.Forwarder
{
c := k8sportforward.ForwarderConfig{
Expand All @@ -191,7 +193,7 @@ func TestMetrics(t *testing.T) {
t.Fatalf("could not get %#q pod %#v", project.Name(), err)
}

t.Logf("waited for %#q pod", project.Name())
t.Logf("waited for %#q pod: %s", project.Name(), podName)
}

var tunnel *k8sportforward.Tunnel
Expand Down Expand Up @@ -250,13 +252,13 @@ func TestMetrics(t *testing.T) {
app.Name,
app.Namespace,
app.Status.Release.Status,
"false", // upgrade_avaiable is false
"false", // upgrade_available is false
expkey.FormatVersion(app.Spec.Version), // version is the desired version
strconv.FormatBool(app.Spec.Version != app.Status.Version))

t.Logf("f\n%s", expectedAppExporterMetric)
t.Logf("Expected app-exporter metrics:\n%s", expectedAppExporterMetric)

app = &v1alpha1.App{}
testApp = &v1alpha1.App{}
err = k8sClients.CtrlClient().Get(ctx, types.NamespacedName{Namespace: "test-app", Name: "test-app"}, testApp)
if err != nil {
t.Fatalf("expected nil got %#q", err)
Expand All @@ -273,10 +275,12 @@ func TestMetrics(t *testing.T) {
testApp.Name,
testApp.Namespace,
testApp.Status.Release.Status,
"false", // upgrade_avaiable is false
"false", // upgrade_available is false
expkey.FormatVersion(testApp.Spec.Version), // version is the desired version
strconv.FormatBool(testApp.Spec.Version != testApp.Status.Version))

t.Logf("Expected test-app metrics:\n%s", expectedTestAppMetric)

respBytes, err := ioutil.ReadAll(metricsResp.Body)
if err != nil {
t.Fatalf("expected nil got %#q", err)
Expand Down

0 comments on commit 27b8e71

Please sign in to comment.