Files
kaniko/integration/integration_with_context_test.go
Matt Moore 49f0154b3f Fix the e2e K8s test (#1842)
* Debugging the integration testing.

It seems to be consistently failing (also fix a typo in the file/leg name).

I'm disabling `-v` for `go test` because it interleaves the test output in ways that make it painful to read a single failing test's output when `t.Parallel` is involved.

* Try swapping registry:2 for the registry add-on

* Drop logf and make Logger private
2021-12-17 14:43:38 -05:00

70 lines
1.6 KiB
Go

/*
Copyright 2018 Google LLC
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 (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
)
func TestWithContext(t *testing.T) {
cwd, err := os.Getwd()
if err != nil {
t.Fatal(err)
}
dir := filepath.Join(cwd, "dockerfiles-with-context")
testDirs, err := ioutil.ReadDir(dir)
if err != nil {
t.Fatal(err)
}
builder := NewDockerFileBuilder()
for _, tdInfo := range testDirs {
name := tdInfo.Name()
testDir := filepath.Join(dir, name)
t.Run("test_with_context_"+name, func(t *testing.T) {
t.Parallel()
if err := builder.BuildImageWithContext(
t, config, "", name, testDir,
); err != nil {
t.Fatal(err)
}
dockerImage := GetDockerImage(config.imageRepo, name)
kanikoImage := GetKanikoImage(config.imageRepo, name)
diff := containerDiff(t, daemonPrefix+dockerImage, kanikoImage, "--no-cache")
expected := fmt.Sprintf(emptyContainerDiff, dockerImage, kanikoImage, dockerImage, kanikoImage)
checkContainerDiffOutput(t, diff, expected)
})
}
if err := logBenchmarks("benchmark"); err != nil {
t.Logf("Failed to create benchmark file: %v", err)
}
}