Skip to content

Commit

Permalink
Add an integration test for skaffold credits
Browse files Browse the repository at this point in the history
Signed-off-by: David Gageot <david@gageot.net>
  • Loading branch information
dgageot committed Dec 24, 2019
1 parent 865c3f5 commit a11a36c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
43 changes: 43 additions & 0 deletions integration/credits_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Copyright 2019 The Skaffold Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package integration

import (
"io/ioutil"
"testing"

"github.com/GoogleContainerTools/skaffold/integration/skaffold"
"github.com/GoogleContainerTools/skaffold/testutil"
)

func TestCredits(t *testing.T) {
if testing.Short() || RunOnGCP() {
t.Skip("skipping kind integration test")
}

testutil.Run(t, "credits", func(t *testutil.T) {
tmpDir := t.NewTempDir().Chdir()

out, err := skaffold.Credits().RunWithCombinedOutput(t.T)
t.CheckNoError(err)
t.CheckContains("Successfully exported third party notices", string(out))

content, err := ioutil.ReadFile(tmpDir.Path("skaffold-credits/github.com/docker/docker/LICENSE"))
t.CheckNoError(err)
t.CheckContains("Apache License", string(content))
})
}
5 changes: 5 additions & 0 deletions integration/skaffold/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ func Schema(args ...string) *RunBuilder {
return &RunBuilder{command: "schema", args: args}
}

// Credits runs `skaffold credits` with the given arguments.
func Credits(args ...string) *RunBuilder {
return &RunBuilder{command: "credits", args: args}
}

func GeneratePipeline(args ...string) *RunBuilder {
return &RunBuilder{command: "generate-pipeline", args: args}
}
Expand Down

0 comments on commit a11a36c

Please sign in to comment.