Skip to content

Commit

Permalink
apps: wip: fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mfojtik committed Sep 1, 2017
1 parent 0482a35 commit 88d4bd7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/integration/imagestream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
stratsupport "github.com/openshift/origin/pkg/deploy/strategy/support"
imagetest "github.com/openshift/origin/pkg/image/admission/testutil"
imageapi "github.com/openshift/origin/pkg/image/apis/image"
imageclient "github.com/openshift/origin/pkg/image/generated/internalclientset"
testutil "github.com/openshift/origin/test/util"
testserver "github.com/openshift/origin/test/util/server"
)
Expand Down Expand Up @@ -406,7 +407,7 @@ func TestImageStreamTagLifecycleHook(t *testing.T) {
}

// can tag to a stream that exists
exec := stratsupport.NewHookExecutor(nil, clusterAdminClient, clusterAdminKubeClientset.Core(), os.Stdout, kapi.Codecs.UniversalDecoder())
exec := stratsupport.NewHookExecutor(nil, imageclient.NewForConfigOrDie(testutil.GetClusterAdminClientConfigOrDie(clusterAdminKubeConfig)), clusterAdminKubeClientset.Core(), os.Stdout, kapi.Codecs.UniversalDecoder())
err = exec.Execute(
&deployapi.LifecycleHook{
TagImages: []deployapi.TagImageHook{
Expand Down Expand Up @@ -444,7 +445,7 @@ func TestImageStreamTagLifecycleHook(t *testing.T) {
}

// can execute a second time the same tag and it should work
exec = stratsupport.NewHookExecutor(nil, clusterAdminClient, clusterAdminKubeClientset.Core(), os.Stdout, kapi.Codecs.UniversalDecoder())
exec = stratsupport.NewHookExecutor(nil, imageclient.NewForConfigOrDie(testutil.GetClusterAdminClientConfigOrDie(clusterAdminKubeConfig)), clusterAdminKubeClientset.Core(), os.Stdout, kapi.Codecs.UniversalDecoder())
err = exec.Execute(
&deployapi.LifecycleHook{
TagImages: []deployapi.TagImageHook{
Expand Down Expand Up @@ -476,7 +477,7 @@ func TestImageStreamTagLifecycleHook(t *testing.T) {
}

// can lifecycle tag a new image stream
exec = stratsupport.NewHookExecutor(nil, clusterAdminClient, clusterAdminKubeClientset.Core(), os.Stdout, kapi.Codecs.UniversalDecoder())
exec = stratsupport.NewHookExecutor(nil, imageclient.NewForConfigOrDie(testutil.GetClusterAdminClientConfigOrDie(clusterAdminKubeConfig)), clusterAdminKubeClientset.Core(), os.Stdout, kapi.Codecs.UniversalDecoder())
err = exec.Execute(
&deployapi.LifecycleHook{
TagImages: []deployapi.TagImageHook{
Expand Down
8 changes: 8 additions & 0 deletions test/util/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ func GetClusterAdminClientConfig(adminKubeConfigFile string) (*restclient.Config
return conf, nil
}

func GetClusterAdminClientConfigOrDie(adminKubeConfigFile string) *restclient.Config {
conf, err := GetClusterAdminClientConfig(adminKubeConfigFile)
if err != nil {
panic(err)
}
return conf
}

func GetClientForUser(clientConfig restclient.Config, username string) (*client.Client, kclientset.Interface, *restclient.Config, error) {
token, err := tokencmd.RequestToken(&clientConfig, nil, username, "password")
if err != nil {
Expand Down

0 comments on commit 88d4bd7

Please sign in to comment.