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,14 +575,42 @@ 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 != "" {
|
||||||
b, ioerr := io.ReadAll(res.Body)
|
if _, res, err := c.Enterprise.CreateRegistrationToken(ctx, e.testEnterprise); err != nil {
|
||||||
if ioerr != nil {
|
b, ioerr := io.ReadAll(res.Body)
|
||||||
t.Logf("%v", ioerr)
|
if ioerr != nil {
|
||||||
|
t.Logf("%v", ioerr)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
t.Logf(string(b))
|
||||||
|
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 err
|
||||||
}
|
}
|
||||||
t.Logf(string(b))
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue