Skip to content

Commit 7f331ba

Browse files
committed
Add an integration test for skaffold credits
Signed-off-by: David Gageot <[email protected]>
1 parent 28ff13c commit 7f331ba

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

integration/credits_test.go

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright 2019 The Skaffold Authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package integration
18+
19+
import (
20+
"io/ioutil"
21+
"testing"
22+
23+
"github.com/GoogleContainerTools/skaffold/integration/skaffold"
24+
"github.com/GoogleContainerTools/skaffold/testutil"
25+
)
26+
27+
func TestCredits(t *testing.T) {
28+
if testing.Short() || RunOnGCP() {
29+
t.Skip("skipping kind integration test")
30+
}
31+
32+
testutil.Run(t, "credits", func(t *testutil.T) {
33+
tmpDir := t.NewTempDir().Chdir()
34+
35+
out, err := skaffold.Credits().RunWithCombinedOutput(t.T)
36+
t.CheckNoError(err)
37+
t.CheckContains("Successfully exported third party notices", string(out))
38+
39+
content, err := ioutil.ReadFile(tmpDir.Path("skaffold-credits/github.com/docker/docker/LICENSE"))
40+
t.CheckNoError(err)
41+
t.CheckContains("Apache License", string(content))
42+
})
43+
}

integration/skaffold/helper.go

+5
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ func Schema(args ...string) *RunBuilder {
9898
return &RunBuilder{command: "schema", args: args}
9999
}
100100

101+
// Credits runs `skaffold credits` with the given arguments.
102+
func Credits(args ...string) *RunBuilder {
103+
return &RunBuilder{command: "credits", args: args}
104+
}
105+
101106
func GeneratePipeline(args ...string) *RunBuilder {
102107
return &RunBuilder{command: "generate-pipeline", args: args}
103108
}

0 commit comments

Comments
 (0)