Skip to content

Commit 7576cc8

Browse files
Disable windows tests for UAP (#1898)
1 parent 856c168 commit 7576cc8

File tree

4 files changed

+36
-27
lines changed

4 files changed

+36
-27
lines changed

integration_test/agents/agents.go

+7-13
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func RunOpsAgentDiagnostics(ctx context.Context, logger *logging.DirectoryLogger
189189
gce.RunRemotely(metricsCtx, logger.ToFile("fluent_bit_metrics.txt"), vm, "sudo curl -s localhost:20202/metrics")
190190
gce.RunRemotely(metricsCtx, logger.ToFile("otel_metrics.txt"), vm, "sudo curl -s localhost:20201/metrics")
191191

192-
isUAPPlugin := IsOpsAgentUAPPlugin()
192+
isUAPPlugin := gce.IsOpsAgentUAPPlugin()
193193
if isUAPPlugin {
194194
gce.RunRemotely(ctx, logger.ToFile("status_for_ops_agent_uap_plugin.txt"), vm, fmt.Sprintf("grpcurl -plaintext -d '{}' localhost:%s plugin_comm.GuestAgentPlugin/GetStatus", OpsAgentPluginServerPort))
195195
} else {
@@ -206,7 +206,7 @@ func RunOpsAgentDiagnostics(ctx context.Context, logger *logging.DirectoryLogger
206206
}
207207

208208
func getOpsAgentLogFilesList(imageSpec string) []string {
209-
if IsOpsAgentUAPPlugin() {
209+
if gce.IsOpsAgentUAPPlugin() {
210210
return []string{
211211
gce.SyslogLocation(imageSpec),
212212
"/var/lib/google-guest-agent/agent_state/plugins/ops-agent-plugin/log/google-cloud-ops-agent/health-checks.log",
@@ -233,7 +233,7 @@ func getOpsAgentLogFilesList(imageSpec string) []string {
233233
}
234234

235235
func runOpsAgentDiagnosticsWindows(ctx context.Context, logger *logging.DirectoryLogger, vm *gce.VM) {
236-
if IsOpsAgentUAPPlugin() {
236+
if gce.IsOpsAgentUAPPlugin() {
237237
return
238238
}
239239
gce.RunRemotely(ctx, logger.ToFile("windows_System_log.txt"), vm, "Get-WinEvent -LogName System | Format-Table -AutoSize -Wrap")
@@ -693,7 +693,7 @@ func InstallStandaloneWindowsMonitoringAgent(ctx context.Context, logger *log.Lo
693693
}
694694

695695
func getRestartOpsAgentCmd(imageSpec string) string {
696-
if IsOpsAgentUAPPlugin() {
696+
if gce.IsOpsAgentUAPPlugin() {
697697
if gce.IsWindows(imageSpec) {
698698
return ""
699699
}
@@ -770,7 +770,7 @@ func InstallOpsAgent(ctx context.Context, logger *log.Logger, vm *gce.VM, locati
770770
return fmt.Errorf("invalid PackageLocation: location.artifactRegistryRegion was nonempty yet location.repoSuffix was empty. location=%#v", location)
771771
}
772772

773-
if IsOpsAgentUAPPlugin() {
773+
if gce.IsOpsAgentUAPPlugin() {
774774
return InstallOpsAgentUAPPlugin(ctx, logger, vm, location)
775775
}
776776

@@ -874,7 +874,7 @@ func SetupOpsAgentFrom(ctx context.Context, logger *log.Logger, vm *gce.VM, conf
874874
if err := RestartOpsAgent(ctx, logger, vm); err != nil {
875875
return err
876876
}
877-
} else if IsOpsAgentUAPPlugin() {
877+
} else if gce.IsOpsAgentUAPPlugin() {
878878
return RestartOpsAgent(ctx, logger, vm)
879879
}
880880
// Give agents time to start up.
@@ -1040,7 +1040,7 @@ func installWindowsPackageFromGCS(ctx context.Context, logger *log.Logger, vm *g
10401040
}
10411041

10421042
func GetOtelConfigPath(imageSpec string) string {
1043-
if IsOpsAgentUAPPlugin() {
1043+
if gce.IsOpsAgentUAPPlugin() {
10441044
if gce.IsWindows(imageSpec) {
10451045
return ""
10461046
}
@@ -1052,9 +1052,3 @@ func GetOtelConfigPath(imageSpec string) string {
10521052
}
10531053
return "/var/run/google-cloud-ops-agent-opentelemetry-collector/otel.yaml"
10541054
}
1055-
1056-
func IsOpsAgentUAPPlugin() bool {
1057-
// ok is true when the env variable is preset in the environment.
1058-
value, ok := os.LookupEnv("IS_OPS_AGENT_UAP_PLUGIN")
1059-
return ok && value != ""
1060-
}

integration_test/gce/gce_testing.go

+10
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,12 @@ func IsDebianBased(imageSpec string) bool {
14251425
return strings.Contains(imageSpec, "debian") || strings.Contains(imageSpec, "ubuntu")
14261426
}
14271427

1428+
func IsOpsAgentUAPPlugin() bool {
1429+
// ok is true when the env variable is preset in the environment.
1430+
value, ok := os.LookupEnv("IS_OPS_AGENT_UAP_PLUGIN")
1431+
return ok && value != ""
1432+
}
1433+
14281434
// CreateInstance launches a new VM instance based on the given options.
14291435
// Also waits for the instance to be reachable over ssh.
14301436
// Returns a VM object or an error (never both). The caller is responsible for
@@ -2068,6 +2074,10 @@ func RunForEachImage(t *testing.T, testBody func(t *testing.T, imageSpec string)
20682074
imageSpecs := strings.Split(imageSpecsEnv, ",")
20692075
for _, imageSpec := range imageSpecs {
20702076
imageSpec := imageSpec // https://golang.org/doc/faq#closures_and_goroutines
2077+
// FIXME(b/398862433): Re-enable tests when writing windows implementation
2078+
if IsOpsAgentUAPPlugin() && IsWindows(imageSpec) {
2079+
continue
2080+
}
20712081
t.Run(imageSpec, func(t *testing.T) {
20722082
testBody(t, imageSpec)
20732083
})

integration_test/ops_agent_test/main_test.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func workDirForImage(imageSpec string) string {
9595
}
9696

9797
func startCommandForImage(imageSpec string) string {
98-
if agents.IsOpsAgentUAPPlugin() {
98+
if gce.IsOpsAgentUAPPlugin() {
9999
if gce.IsWindows(imageSpec) {
100100
return ""
101101
}
@@ -110,7 +110,7 @@ func startCommandForImage(imageSpec string) string {
110110
}
111111

112112
func stopCommandForImage(imageSpec string) string {
113-
if agents.IsOpsAgentUAPPlugin() {
113+
if gce.IsOpsAgentUAPPlugin() {
114114
if gce.IsWindows(imageSpec) {
115115
return ""
116116
}
@@ -771,7 +771,7 @@ func TestCustomLogFile(t *testing.T) {
771771

772772
func TestPluginGetStatusReturnsHealthyStatusOnSuccessfulOpsAgentStart(t *testing.T) {
773773
t.Parallel()
774-
if !agents.IsOpsAgentUAPPlugin() {
774+
if !gce.IsOpsAgentUAPPlugin() {
775775
t.SkipNow()
776776
}
777777

@@ -797,7 +797,7 @@ func TestPluginGetStatusReturnsHealthyStatusOnSuccessfulOpsAgentStart(t *testing
797797

798798
func TestPluginGetStatusReturnsUnhealthyStatusOnSubAgentTermination(t *testing.T) {
799799
t.Parallel()
800-
if !agents.IsOpsAgentUAPPlugin() {
800+
if !gce.IsOpsAgentUAPPlugin() {
801801
t.SkipNow()
802802
}
803803

@@ -1728,7 +1728,7 @@ func TestResourceNameLabel(t *testing.T) {
17281728

17291729
func TestLogFilePathLabel(t *testing.T) {
17301730
t.Parallel()
1731-
if agents.IsOpsAgentUAPPlugin() {
1731+
if gce.IsOpsAgentUAPPlugin() {
17321732
t.SkipNow()
17331733
}
17341734
t.Run("fluent-bit", func(t *testing.T) {
@@ -1835,7 +1835,7 @@ EOF
18351835
// Escape record accessor dollar-signs
18361836
strings.ReplaceAll(fluentBitArgs, "$", `\$`))
18371837

1838-
if agents.IsOpsAgentUAPPlugin() {
1838+
if gce.IsOpsAgentUAPPlugin() {
18391839
command = fmt.Sprintf(`
18401840
sudo touch %s
18411841
sudo tee %s > /dev/null <<EOF
@@ -2918,7 +2918,7 @@ func TestPrometheusMetricsWithJSONExporter(t *testing.T) {
29182918
module: [default]
29192919
static_configs:
29202920
- targets:
2921-
- http://localhost:8000/data.json
2921+
- http://localhost:8000/data.json
29222922
relabel_configs:
29232923
- source_labels: [__address__]
29242924
target_label: __param_target
@@ -2927,7 +2927,7 @@ func TestPrometheusMetricsWithJSONExporter(t *testing.T) {
29272927
target_label: instance
29282928
replacement: '$1'
29292929
- target_label: __address__
2930-
replacement: localhost:7979
2930+
replacement: localhost:7979
29312931
service:
29322932
pipelines:
29332933
prom_pipeline:
@@ -3885,7 +3885,7 @@ func TestMetricsAgentCrashRestart(t *testing.T) {
38853885
t.Parallel()
38863886
gce.RunForEachImage(t, func(t *testing.T, imageSpec string) {
38873887
t.Parallel()
3888-
if agents.IsOpsAgentUAPPlugin() {
3888+
if gce.IsOpsAgentUAPPlugin() {
38893889
// Ops Agent Plugin does not restart subagents on termination.
38903890
t.SkipNow()
38913891
}
@@ -3908,7 +3908,7 @@ func TestLoggingAgentCrashRestart(t *testing.T) {
39083908
t.Parallel()
39093909
gce.RunForEachImage(t, func(t *testing.T, imageSpec string) {
39103910
t.Parallel()
3911-
if agents.IsOpsAgentUAPPlugin() {
3911+
if gce.IsOpsAgentUAPPlugin() {
39123912
// Ops Agent Plugin does not restart subagents on termination.
39133913
t.SkipNow()
39143914
}
@@ -3988,7 +3988,7 @@ func TestDiagnosticsCrashRestart(t *testing.T) {
39883988
t.Parallel()
39893989
gce.RunForEachImage(t, func(t *testing.T, imageSpec string) {
39903990
t.Parallel()
3991-
if agents.IsOpsAgentUAPPlugin() {
3991+
if gce.IsOpsAgentUAPPlugin() {
39923992
// Ops Agent Plugin does not restart the diagnostics service on termination.
39933993
t.SkipNow()
39943994
}
@@ -4052,7 +4052,7 @@ func TestUpgradeOpsAgent(t *testing.T) {
40524052
t.Parallel()
40534053
gce.RunForEachImage(t, func(t *testing.T, imageSpec string) {
40544054
t.Parallel()
4055-
if agents.IsOpsAgentUAPPlugin() {
4055+
if gce.IsOpsAgentUAPPlugin() {
40564056
// Ops Agent plugin version upgrade is handled by UAP.
40574057
t.SkipNow()
40584058
}
@@ -4571,7 +4571,7 @@ func getRecentServiceOutputForImage(imageSpec string) string {
45714571
}
45724572

45734573
func getHealthCheckResultsForImage(ctx context.Context, logger *log.Logger, vm *gce.VM) (string, error) {
4574-
if agents.IsOpsAgentUAPPlugin() {
4574+
if gce.IsOpsAgentUAPPlugin() {
45754575
cmdOut, err := gce.RunRemotely(ctx, logger, vm, getHealthCheckLogsForUAPPluginByImage(vm.ImageSpec))
45764576
return cmdOut.Stdout, err
45774577

@@ -4972,7 +4972,7 @@ func TestRestartVM(t *testing.T) {
49724972
t.Fatal(err)
49734973
}
49744974

4975-
isUAPPlugin := agents.IsOpsAgentUAPPlugin()
4975+
isUAPPlugin := gce.IsOpsAgentUAPPlugin()
49764976
if isUAPPlugin {
49774977
cmdOut, err := gce.RunRemotely(ctx, logger, vm, getUAPPluginStatusForImage(vm.ImageSpec))
49784978
if err != nil {

integration_test/third_party_apps_test/main_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ func getAcceleratorCount(machineType string) string {
949949
// Also, restrict `SAPHANAImageSpec` to only test `SAPHANAApp` and skip that
950950
// app on all other images too.
951951
func determineTestsToSkip(tests []test, impactedApps map[string]bool) {
952+
952953
for i, test := range tests {
953954
if testing.Short() {
954955
_, testApp := impactedApps[test.app]
@@ -982,6 +983,10 @@ func determineTestsToSkip(tests []test, impactedApps map[string]bool) {
982983
tests[i].skipReason = fmt.Sprintf("Skipping %v because we only want to test %v on %v", test.app, SAPHANAApp, SAPHANAImageSpec)
983984
continue
984985
}
986+
// FIXME(b/398862433): Re-enable tests when writing windows implementation
987+
if gce.IsOpsAgentUAPPlugin() && strings.Contains(test.imageSpec, "windows") {
988+
tests[i].skipReason = "Skipping test due to windows not being implemented on UAP"
989+
}
985990
}
986991
}
987992

0 commit comments

Comments
 (0)