Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.7] Bug 1939477: Fix unit test to use new IS #769

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 36 additions & 36 deletions pkg/helpers/newapp/newapptest/newapp_test.go
Expand Up @@ -517,7 +517,7 @@ func TestNewAppRunAll(t *testing.T) {
},
checkPort: "8080",
expected: map[string][]string{
"imageStream": {"ruby-hello-world", "ruby-25-centos7"},
"imageStream": {"ruby-hello-world", "ruby-27-centos7"},
"buildConfig": {"ruby-hello-world"},
"deployment": {"ruby-hello-world"},
"service": {"ruby-hello-world"},
Expand Down Expand Up @@ -715,7 +715,7 @@ func TestNewAppRunAll(t *testing.T) {
Resolvers: cmd.Resolvers{
DockerSearcher: app.DockerClientSearcher{
Client: &apptest.FakeDockerClient{
Images: []docker.APIImages{{RepoTags: []string{"centos/ruby-25-centos7"}}},
Images: []docker.APIImages{{RepoTags: []string{"centos/ruby-27-centos7"}}},
Image: dockerBuilderImage(),
},
Insecure: true,
Expand Down Expand Up @@ -743,7 +743,7 @@ func TestNewAppRunAll(t *testing.T) {
OriginNamespace: "default",
},
expected: map[string][]string{
"imageStream": {"ruby-hello-world", "ruby-25-centos7"},
"imageStream": {"ruby-hello-world", "ruby-27-centos7"},
"buildConfig": {"ruby-hello-world"},
"deployment": {"ruby-hello-world"},
"service": {"ruby-hello-world"},
Expand All @@ -761,7 +761,7 @@ func TestNewAppRunAll(t *testing.T) {
Resolvers: cmd.Resolvers{
DockerSearcher: app.DockerClientSearcher{
Client: &apptest.FakeDockerClient{
Images: []docker.APIImages{{RepoTags: []string{"centos/ruby-25-centos7"}}},
Images: []docker.APIImages{{RepoTags: []string{"centos/ruby-27-centos7"}}},
Image: dockerBuilderImage(),
},
Insecure: true,
Expand Down Expand Up @@ -1075,7 +1075,7 @@ func TestNewAppRunBuilds(t *testing.T) {
config: &cmd.AppConfig{
ComponentInputs: cmd.ComponentInputs{
SourceRepositories: []string{"https://github.com/openshift/ruby-hello-world"},
DockerImages: []string{"centos/ruby-25-centos7", "openshift/nodejs-010-centos7"},
DockerImages: []string{"centos/ruby-27-centos7", "openshift/nodejs-010-centos7"},
},
GenerationInputs: cmd.GenerationInputs{
OutputDocker: true,
Expand All @@ -1085,7 +1085,7 @@ func TestNewAppRunBuilds(t *testing.T) {
// TODO: this test used to silently ignore components that were not builders (i.e. user input)
// That's bad, so the code should either error in this case or be a bit smarter.
"buildConfig": {"ruby-hello-world", "ruby-hello-world-1"},
"imageStream": {"nodejs-010-centos7", "ruby-25-centos7"},
"imageStream": {"nodejs-010-centos7", "ruby-27-centos7"},
},
},
{
Expand Down Expand Up @@ -1181,12 +1181,12 @@ func TestNewAppRunBuilds(t *testing.T) {
SourceRepositories: []string{"https://github.com/openshift/ruby-hello-world"},
},
GenerationInputs: cmd.GenerationInputs{
Dockerfile: "FROM centos/ruby-25-centos7\nRUN false",
Dockerfile: "FROM centos/ruby-27-centos7\nRUN false",
},
},
expected: map[string][]string{
"buildConfig": {"ruby-hello-world"},
"imageStream": {"ruby-25-centos7", "ruby-hello-world"},
"imageStream": {"ruby-27-centos7", "ruby-hello-world"},
},
checkResult: func(res *cmd.AppResult) error {
var bc *buildv1.BuildConfig
Expand All @@ -1206,7 +1206,7 @@ func TestNewAppRunBuilds(t *testing.T) {
if bc.Spec.Source.Dockerfile != nil {
got = *bc.Spec.Source.Dockerfile
}
want := "FROM centos/ruby-25-centos7\nRUN false"
want := "FROM centos/ruby-27-centos7\nRUN false"
if got != want {
return fmt.Errorf("bc.Spec.Source.Dockerfile = %q; want %q", got, want)
}
Expand Down Expand Up @@ -1247,7 +1247,7 @@ func TestNewAppRunBuilds(t *testing.T) {
},
},
GenerationInputs: cmd.GenerationInputs{
Dockerfile: "FROM centos/ruby-25-centos7\nRUN false",
Dockerfile: "FROM centos/ruby-27-centos7\nRUN false",
},
},
expectedErr: func(err error) bool {
Expand All @@ -1269,7 +1269,7 @@ func TestNewAppRunBuilds(t *testing.T) {
},
expected: map[string][]string{
"buildConfig": {"ruby-hello-world"},
"imageStream": {"mongodb-26-centos7", "ruby-25-centos7", "ruby-hello-world"},
"imageStream": {"mongodb-26-centos7", "ruby-27-centos7", "ruby-hello-world"},
},
checkResult: func(res *cmd.AppResult) error {
var bc *buildv1.BuildConfig
Expand Down Expand Up @@ -1582,20 +1582,20 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) {
config: &cmd.AppConfig{
GenerationInputs: cmd.GenerationInputs{
OutputDocker: true,
To: "centos/ruby-25-centos7",
Dockerfile: "FROM centos/ruby-25-centos7:latest",
To: "centos/ruby-27-centos7",
Dockerfile: "FROM centos/ruby-27-centos7:latest",
},
},
expected: map[string][]string{
"buildConfig": {"ruby-25-centos7"},
"imageStream": {"ruby-25-centos7"},
"buildConfig": {"ruby-27-centos7"},
"imageStream": {"ruby-27-centos7"},
},
checkOutput: func(stdout, stderr io.Reader) error {
got, err := ioutil.ReadAll(stderr)
if err != nil {
return err
}
want := "--> WARNING: output image of \"centos/ruby-25-centos7:latest\" should be different than input\n"
want := "--> WARNING: output image of \"centos/ruby-27-centos7:latest\" should be different than input\n"
if string(got) != want {
return fmt.Errorf("stderr: got %q; want %q", got, want)
}
Expand Down Expand Up @@ -1630,20 +1630,20 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) {
name: "successful build from dockerfile with identical input and output image references with warning(2)",
config: &cmd.AppConfig{
GenerationInputs: cmd.GenerationInputs{
Dockerfile: "FROM centos/ruby-25-centos7\nRUN yum install -y httpd",
To: "ruby-25-centos7",
Dockerfile: "FROM centos/ruby-27-centos7\nRUN yum install -y httpd",
To: "ruby-27-centos7",
},
},
expected: map[string][]string{
"buildConfig": {"ruby-25-centos7"},
"imageStream": {"ruby-25-centos7"},
"buildConfig": {"ruby-27-centos7"},
"imageStream": {"ruby-27-centos7"},
},
checkOutput: func(stdout, stderr io.Reader) error {
got, err := ioutil.ReadAll(stderr)
if err != nil {
return err
}
want := "--> WARNING: output image of \"centos/ruby-25-centos7:latest\" should be different than input\n"
want := "--> WARNING: output image of \"centos/ruby-27-centos7:latest\" should be different than input\n"
if string(got) != want {
return fmt.Errorf("stderr: got %q; want %q", got, want)
}
Expand All @@ -1668,12 +1668,12 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) {
name: "unsuccessful build from dockerfile due to identical input and output image references(2)",
config: &cmd.AppConfig{
GenerationInputs: cmd.GenerationInputs{
Dockerfile: "FROM centos/ruby-25-centos7\nRUN yum install -y httpd",
Dockerfile: "FROM centos/ruby-27-centos7\nRUN yum install -y httpd",
},
},
expectedErr: func(err error) bool {
e := app.CircularOutputReferenceError{
Reference: "centos/ruby-25-centos7:latest",
Reference: "centos/ruby-27-centos7:latest",
}
return err.Error() == fmt.Errorf("%v, set a different tag with --to", e).Error()
},
Expand All @@ -1683,8 +1683,8 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) {
config: &cmd.AppConfig{
GenerationInputs: cmd.GenerationInputs{
OutputDocker: true,
To: "centos/ruby-25-centos7",
Dockerfile: "FROM centos/ruby-25-centos7",
To: "centos/ruby-27-centos7",
Dockerfile: "FROM centos/ruby-27-centos7",
},
Resolvers: cmd.Resolvers{
DockerSearcher: app.DockerClientSearcher{
Expand All @@ -1695,15 +1695,15 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) {
},
},
expected: map[string][]string{
"buildConfig": {"ruby-25-centos7"},
"imageStream": {"ruby-25-centos7"},
"buildConfig": {"ruby-27-centos7"},
"imageStream": {"ruby-27-centos7"},
},
checkOutput: func(stdout, stderr io.Reader) error {
got, err := ioutil.ReadAll(stderr)
if err != nil {
return err
}
want := "--> WARNING: output image of \"centos/ruby-25-centos7:latest\" should be different than input\n"
want := "--> WARNING: output image of \"centos/ruby-27-centos7:latest\" should be different than input\n"
if string(got) != want {
return fmt.Errorf("stderr: got %q; want %q", got, want)
}
Expand All @@ -1715,8 +1715,8 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) {
config: &cmd.AppConfig{
GenerationInputs: cmd.GenerationInputs{
OutputDocker: true,
To: "centos/ruby-25-centos7",
Dockerfile: "FROM centos/ruby-25-centos7:latest",
To: "centos/ruby-27-centos7",
Dockerfile: "FROM centos/ruby-27-centos7:latest",
},
Resolvers: cmd.Resolvers{
DockerSearcher: app.DockerClientSearcher{
Expand All @@ -1727,15 +1727,15 @@ func TestNewAppBuildOutputCycleDetection(t *testing.T) {
},
},
expected: map[string][]string{
"buildConfig": {"ruby-25-centos7"},
"imageStream": {"ruby-25-centos7"},
"buildConfig": {"ruby-27-centos7"},
"imageStream": {"ruby-27-centos7"},
},
checkOutput: func(stdout, stderr io.Reader) error {
got, err := ioutil.ReadAll(stderr)
if err != nil {
return err
}
want := "--> WARNING: output image of \"centos/ruby-25-centos7:latest\" should be different than input\n"
want := "--> WARNING: output image of \"centos/ruby-27-centos7:latest\" should be different than input\n"
if string(got) != want {
return fmt.Errorf("stderr: got %q; want %q", got, want)
}
Expand Down Expand Up @@ -1816,7 +1816,7 @@ func TestNewAppNewBuildEnvVars(t *testing.T) {
config: &cmd.AppConfig{
ComponentInputs: cmd.ComponentInputs{
SourceRepositories: []string{"https://github.com/openshift/ruby-hello-world"},
DockerImages: []string{"centos/ruby-25-centos7", "openshift/nodejs-010-centos7"},
DockerImages: []string{"centos/ruby-27-centos7", "openshift/nodejs-010-centos7"},
},
GenerationInputs: cmd.GenerationInputs{
OutputDocker: true,
Expand Down Expand Up @@ -1892,7 +1892,7 @@ func TestNewAppBuildConfigEnvVarsAndSecrets(t *testing.T) {
config: &cmd.AppConfig{
ComponentInputs: cmd.ComponentInputs{
SourceRepositories: []string{"https://github.com/openshift/ruby-hello-world"},
DockerImages: []string{"centos/ruby-25-centos7", "centos/mongodb-26-centos7"},
DockerImages: []string{"centos/ruby-27-centos7", "centos/mongodb-26-centos7"},
},
GenerationInputs: cmd.GenerationInputs{
OutputDocker: true,
Expand Down Expand Up @@ -2327,7 +2327,7 @@ func fakeDockerSearcher() app.Searcher {
func fakeSimpleDockerSearcher() app.Searcher {
return app.DockerClientSearcher{
Client: &apptest.FakeDockerClient{
Images: []docker.APIImages{{RepoTags: []string{"centos/ruby-25-centos7"}}},
Images: []docker.APIImages{{RepoTags: []string{"centos/ruby-27-centos7"}}},
Image: &docker.Image{
ID: "ruby",
Config: &docker.Config{
Expand Down