@@ -86,16 +86,10 @@ func TestMemcached(t *testing.T) {
8686 ctx .AddFinalizerFn (func () error { return os .RemoveAll (absProjectPath ) })
8787
8888 os .Chdir ("memcached-operator" )
89- repo , ok := os .LookupEnv ("TRAVIS_PULL_REQUEST_SLUG" )
90- if repo == "" {
91- repo , ok = os .LookupEnv ("TRAVIS_REPO_SLUG" )
92- }
93- if ok && repo != "" {
94- commitSha , ok := os .LookupEnv ("TRAVIS_PULL_REQUEST_SHA" )
95- if commitSha == "" {
96- commitSha , ok = os .LookupEnv ("TRAVIS_COMMIT" )
97- }
98- if ok && commitSha != "" {
89+ prSlug , ok := os .LookupEnv ("TRAVIS_PULL_REQUEST_SLUG" )
90+ if ok && prSlug != "" {
91+ prSha , ok := os .LookupEnv ("TRAVIS_PULL_REQUEST_SHA" )
92+ if ok && prSha != "" {
9993 gopkg , err := ioutil .ReadFile ("Gopkg.toml" )
10094 if err != nil {
10195 t .Fatal (err )
@@ -108,7 +102,7 @@ func TestMemcached(t *testing.T) {
108102 // correctly.
109103 gopkgString := string (gopkg )
110104 gopkgLoc := strings .LastIndex (gopkgString , "\n name = \" github.com/operator-framework/operator-sdk\" \n " )
111- gopkgString = gopkgString [:gopkgLoc ] + "\n source = \" https://github.com/" + repo + "\" \n revision = \" " + commitSha + "\" \n " + gopkgString [gopkgLoc + 1 :]
105+ gopkgString = gopkgString [:gopkgLoc ] + "\n source = \" https://github.com/" + prSlug + "\" \n revision = \" " + prSha + "\" \n " + gopkgString [gopkgLoc + 1 :]
112106 err = ioutil .WriteFile ("Gopkg.toml" , []byte (gopkgString ), filemode )
113107 if err != nil {
114108 t .Fatalf ("failed to write updated Gopkg.toml: %v" , err )
@@ -121,7 +115,7 @@ func TestMemcached(t *testing.T) {
121115 }
122116 cmdOut , err = exec .Command ("dep" , "ensure" ).CombinedOutput ()
123117 if err != nil {
124- t .Fatalf ("error after modifying Gopkg.toml : %v\n Command Output: %s\n " , err , string (cmdOut ))
118+ t .Fatalf ("error: %v\n Command Output: %s\n " , err , string (cmdOut ))
125119 }
126120
127121 // Set replicas to 2 to test leader election. In production, this should
@@ -214,7 +208,7 @@ func TestMemcached(t *testing.T) {
214208 t .Fatalf ("dep ensure failed: %v\n Command Output:\n %v" , err , string (cmdOut ))
215209 }
216210 // link local sdk to vendor if not in travis
217- if repo == "" {
211+ if prSlug == "" {
218212 os .RemoveAll ("vendor/github.com/operator-framework/operator-sdk/pkg" )
219213 os .Symlink (filepath .Join (gopath , "src/github.com/operator-framework/operator-sdk/pkg" ),
220214 "vendor/github.com/operator-framework/operator-sdk/pkg" )
0 commit comments