~snappy-dev/snappy/15.04-github

« back to all changes in this revision

Viewing changes to integration-tests/testutils/autopkgtest/autopkgtest_test.go

  • Committer: Michael Vogt
  • Date: 2016-05-20 07:33:30 UTC
  • mfrom: (739.1.2)
  • Revision ID: git-v1:cb4764632e9c993b060d58904480d8cddcac7f73
Merge pull request #1178 from fgimenez/add-http-proxy

integration-tests: update 15.04 branch from master to accept http-proxy flag

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
// +build !excludeintegration
3
3
 
4
4
/*
5
 
 * Copyright (C) 2015 Canonical Ltd
 
5
 * Copyright (C) 2015, 2016 Canonical Ltd
6
6
 *
7
7
 * This program is free software: you can redistribute it and/or modify
8
8
 * it under the terms of the GNU General Public License version 3 as
43
43
        imgPath             = "imgPath"
44
44
        testbedIP           = "1.1.1.1"
45
45
        testbedPort         = 90
46
 
        adtrunTpl           = "adt-run -B --setup-commands touch /run/autopkgtest_no_reboot.stamp --override-control %s --built-tree %s --output-dir %s %s"
 
46
        adtrunTpl           = "adt-run -B --override-control %s --built-tree %s --output-dir %s --setup-commands touch /run/autopkgtest_no_reboot.stamp %s"
47
47
)
48
48
 
49
49
type AutoPkgTestSuite struct {
72
72
        execCommand = s.fakeExecCommand
73
73
        prepareTargetDir = s.fakePrepareTargetDir
74
74
        tplExecute = s.fakeTplExecute
75
 
 
76
 
        s.subject = &AutoPkgTest{
77
 
                SourceCodePath:      sourceCodePath,
78
 
                TestArtifactsPath:   testArtifactsPath,
79
 
                TestFilter:          testFilter,
80
 
                IntegrationTestName: integrationTestName,
81
 
                ShellOnFail:         false,
82
 
        }
83
75
}
84
76
 
85
77
func (s *AutoPkgTestSuite) TearDownSuite(c *check.C) {
93
85
        s.mkDirCalls = make(map[string]int)
94
86
        s.tplExecuteCalls = make(map[string]int)
95
87
        s.tplError = false
 
88
 
 
89
        s.subject = &AutoPkgTest{
 
90
                SourceCodePath:      sourceCodePath,
 
91
                TestArtifactsPath:   testArtifactsPath,
 
92
                TestFilter:          testFilter,
 
93
                IntegrationTestName: integrationTestName,
 
94
                ShellOnFail:         false,
 
95
                Env:                 nil,
 
96
        }
96
97
}
97
98
 
98
99
func (s *AutoPkgTestSuite) fakeExecCommand(args ...string) (err error) {
212
213
        }
213
214
}
214
215
 
 
216
func (s *AutoPkgTestSuite) TestAdtRunEnv(c *check.C) {
 
217
        s.subject.Env = map[string]string{"var1": "value1"}
 
218
        s.subject.adtRun("testbed-options")
 
219
 
 
220
        testOutputDir := outputDir(testArtifactsPath)
 
221
        expectedCommandCall := fmt.Sprintf(
 
222
                adtrunTpl, controlFile, sourceCodePath, testOutputDir, "--env var1=value1 testbed-options")
 
223
        c.Check(s.execCalls[expectedCommandCall], check.Equals, 1,
 
224
                check.Commentf("Expected call %s not executed 1 time", expectedCommandCall))
 
225
}
 
226
 
215
227
func tplExecuteCmd(tplFile, outputFile string, data interface{}) string {
216
228
        return fmt.Sprint(tplFile, outputFile, data)
217
229
}