From df75c05a08de6f43ab95f13434e5d6e280914b33 Mon Sep 17 00:00:00 2001 From: Francisco Valente <1435136+franciscovalentecastro@users.noreply.github.com> Date: Thu, 29 Jun 2023 21:13:58 +0000 Subject: [PATCH] Improve integration test query. --- integration_test/ops_agent_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/integration_test/ops_agent_test.go b/integration_test/ops_agent_test.go index 70a9e9cdb4..39500a2ca6 100644 --- a/integration_test/ops_agent_test.go +++ b/integration_test/ops_agent_test.go @@ -3001,8 +3001,14 @@ func TestLoggingSelfLogs(t *testing.T) { if err := gce.WaitForLog(ctx, logger.ToMainLog(), vm, "ops-agent-fluent-bit", time.Hour, `severity="INFO"`); err != nil { t.Error(err) } + + pkgVersion, err := agents.FetchPackageVersions(ctx, logger.ToMainLog(), vm, []agents.AgentPackage{agents.OpsPackage}); + if err != nil { + t.Error(err) + } - if err := gce.WaitForLog(ctx, logger.ToMainLog(), vm, "ops-agent-health", time.Hour, `severity="INFO" AND labels"agent.googleapis.com/health/agentKind"="ops-agent" AND labels"agent.googleapis.com/health/schemaVersion"="v1"`); err != nil { + query := fmt.Sprintf(`severity="INFO" AND labels."agent.googleapis.com/health/agentKind"="ops-agent" AND labels."agent.googleapis.com/health/agentVersion"="%s" AND labels."agent.googleapis.com/health/schemaVersion"="v1"`, pkgVersion[agents.OpsPackage]) + if err := gce.WaitForLog(ctx, logger.ToMainLog(), vm, "ops-agent-health", time.Hour, query); err != nil { t.Error(err) } })