Skip to content

Commit

Permalink
osconfig_tests: increase timeout waiting for osconfig install (#671)
Browse files Browse the repository at this point in the history
Add tests for new windows instances
Add sleep before install in an attempt to deflake 2012 tests
  • Loading branch information
adjackura authored Feb 13, 2019
1 parent b3216a4 commit 07c2e95
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
43 changes: 35 additions & 8 deletions osconfig_tests/test_suites/inventory/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestSuite(ctx context.Context, tswg *sync.WaitGroup, testSuites chan *junit
packageType: []string{"googet", "wua", "qfe"},
shortName: "windows",
startup: &api.MetadataItems{
Key: "windows-startup-script-cmd",
Key: "windows-startup-script-ps1",
Value: &utils.InstallOSConfigGooGet,
},
},
Expand All @@ -82,7 +82,7 @@ func TestSuite(ctx context.Context, tswg *sync.WaitGroup, testSuites chan *junit
packageType: []string{"googet", "wua", "qfe"},
shortName: "windows",
startup: &api.MetadataItems{
Key: "windows-startup-script-cmd",
Key: "windows-startup-script-ps1",
Value: &utils.InstallOSConfigGooGet,
},
},
Expand All @@ -91,7 +91,7 @@ func TestSuite(ctx context.Context, tswg *sync.WaitGroup, testSuites chan *junit
packageType: []string{"googet", "wua", "qfe"},
shortName: "windows",
startup: &api.MetadataItems{
Key: "windows-startup-script-cmd",
Key: "windows-startup-script-ps1",
Value: &utils.InstallOSConfigGooGet,
},
},
Expand All @@ -100,7 +100,7 @@ func TestSuite(ctx context.Context, tswg *sync.WaitGroup, testSuites chan *junit
packageType: []string{"googet", "wua", "qfe"},
shortName: "windows",
startup: &api.MetadataItems{
Key: "windows-startup-script-cmd",
Key: "windows-startup-script-ps1",
Value: &utils.InstallOSConfigGooGet,
},
},
Expand All @@ -109,7 +109,7 @@ func TestSuite(ctx context.Context, tswg *sync.WaitGroup, testSuites chan *junit
packageType: []string{"googet", "wua", "qfe"},
shortName: "windows",
startup: &api.MetadataItems{
Key: "windows-startup-script-cmd",
Key: "windows-startup-script-ps1",
Value: &utils.InstallOSConfigGooGet,
},
},
Expand All @@ -118,7 +118,7 @@ func TestSuite(ctx context.Context, tswg *sync.WaitGroup, testSuites chan *junit
packageType: []string{"googet", "wua", "qfe"},
shortName: "windows",
startup: &api.MetadataItems{
Key: "windows-startup-script-cmd",
Key: "windows-startup-script-ps1",
Value: &utils.InstallOSConfigGooGet,
},
},
Expand All @@ -127,7 +127,34 @@ func TestSuite(ctx context.Context, tswg *sync.WaitGroup, testSuites chan *junit
packageType: []string{"googet", "wua", "qfe"},
shortName: "windows",
startup: &api.MetadataItems{
Key: "windows-startup-script-cmd",
Key: "windows-startup-script-ps1",
Value: &utils.InstallOSConfigGooGet,
},
},
&inventoryTestSetup{
image: "projects/windows-cloud/global/images/family/windows-1809-core",
packageType: []string{"googet", "wua", "qfe"},
shortName: "windows",
startup: &api.MetadataItems{
Key: "windows-startup-script-ps1",
Value: &utils.InstallOSConfigGooGet,
},
},
&inventoryTestSetup{
image: "projects/windows-cloud/global/images/family/windows-2019-core",
packageType: []string{"googet", "wua", "qfe"},
shortName: "windows",
startup: &api.MetadataItems{
Key: "windows-startup-script-ps1",
Value: &utils.InstallOSConfigGooGet,
},
},
&inventoryTestSetup{
image: "projects/windows-cloud/global/images/family/windows-2019",
packageType: []string{"googet", "wua", "qfe"},
shortName: "windows",
startup: &api.MetadataItems{
Key: "windows-startup-script-ps1",
Value: &utils.InstallOSConfigGooGet,
},
},
Expand Down Expand Up @@ -274,7 +301,7 @@ func runGatherInventoryTest(ctx context.Context, testSetup *inventoryTestSetup,
defer inst.Cleanup()

testCase.Logf("Waiting for agent install to complete")
if err := inst.WaitForSerialOutput("osconfig install done", 1, 5*time.Second, 5*time.Minute); err != nil {
if err := inst.WaitForSerialOutput("osconfig install done", 1, 5*time.Second, 7*time.Minute); err != nil {
testCase.WriteFailure("Error waiting for osconfig agent install: %v", err)
return nil, false
}
Expand Down
5 changes: 3 additions & 2 deletions osconfig_tests/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ apt-get install -y google-osconfig-agent
echo 'osconfig install done'`

// InstallOSConfigGooGet installs the osconfig agent on googet based systems.
InstallOSConfigGooGet = `c:\programdata\googet\googet.exe -noconfirm install -sources https://packages.cloud.google.com/yuck/repos/google-osconfig-agent-unstable google-osconfig-agent
echo 'osconfig install done'`
InstallOSConfigGooGet = `Start-Sleep 10
c:\programdata\googet\googet.exe -noconfirm install -sources https://packages.cloud.google.com/yuck/repos/google-osconfig-agent-unstable google-osconfig-agent
Write-Host 'osconfig install done'`

// InstallOSConfigYumEL7 installs the osconfig agent on el7 based systems.
InstallOSConfigYumEL7 = `cat > /etc/yum.repos.d/google-osconfig-agent.repo <<EOM
Expand Down

0 comments on commit 07c2e95

Please sign in to comment.