e2e: Fix broken token expiration checks
This commit is contained in:
		
							parent
							
								
									4925880e5e
								
							
						
					
					
						commit
						915739b972
					
				|  | @ -8,6 +8,7 @@ import ( | ||||||
| 	"os" | 	"os" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| 	"strconv" | 	"strconv" | ||||||
|  | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	"github.com/actions-runner-controller/actions-runner-controller/testing" | 	"github.com/actions-runner-controller/actions-runner-controller/testing" | ||||||
|  | @ -574,7 +575,8 @@ func (e *env) checkGitHubToken(t *testing.T, tok string) error { | ||||||
| 
 | 
 | ||||||
| 	t.Logf("%s", aa) | 	t.Logf("%s", aa) | ||||||
| 
 | 
 | ||||||
| 	if _, res, err := c.Actions.CreateRegistrationToken(ctx, e.testOrg, e.testOrgRepo); err != nil { | 	if e.testEnterprise != "" { | ||||||
|  | 		if _, res, err := c.Enterprise.CreateRegistrationToken(ctx, e.testEnterprise); err != nil { | ||||||
| 			b, ioerr := io.ReadAll(res.Body) | 			b, ioerr := io.ReadAll(res.Body) | ||||||
| 			if ioerr != nil { | 			if ioerr != nil { | ||||||
| 				t.Logf("%v", ioerr) | 				t.Logf("%v", ioerr) | ||||||
|  | @ -583,6 +585,33 @@ func (e *env) checkGitHubToken(t *testing.T, tok string) error { | ||||||
| 			t.Logf(string(b)) | 			t.Logf(string(b)) | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if e.testOrg != "" { | ||||||
|  | 		if _, res, err := c.Actions.CreateOrganizationRegistrationToken(ctx, e.testOrg); err != nil { | ||||||
|  | 			b, ioerr := io.ReadAll(res.Body) | ||||||
|  | 			if ioerr != nil { | ||||||
|  | 				t.Logf("%v", ioerr) | ||||||
|  | 				return err | ||||||
|  | 			} | ||||||
|  | 			t.Logf(string(b)) | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if e.testRepo != "" { | ||||||
|  | 		s := strings.Split(e.testRepo, "/") | ||||||
|  | 		owner, repo := s[0], s[1] | ||||||
|  | 		if _, res, err := c.Actions.CreateRegistrationToken(ctx, owner, repo); err != nil { | ||||||
|  | 			b, ioerr := io.ReadAll(res.Body) | ||||||
|  | 			if ioerr != nil { | ||||||
|  | 				t.Logf("%v", ioerr) | ||||||
|  | 				return err | ||||||
|  | 			} | ||||||
|  | 			t.Logf(string(b)) | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue