MCPcopy Create free account
hub / github.com/actions/actions-runner-controller / TestCleanup

Function TestCleanup

github/github_test.go:132–154  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

130}
131
132func TestCleanup(t *testing.T) {
133 token := "token"
134
135 client := newTestClient()
136 client.regTokens = map[string]*github.RegistrationToken{
137 "active": &github.RegistrationToken{
138 Token: &token,
139 ExpiresAt: &github.Timestamp{Time: time.Now().Add(time.Hour * 1)},
140 },
141 "expired": &github.RegistrationToken{
142 Token: &token,
143 ExpiresAt: &github.Timestamp{Time: time.Now().Add(-time.Hour * 1)},
144 },
145 }
146
147 client.cleanup()
148 if _, ok := client.regTokens["active"]; !ok {
149 t.Errorf("active token was accidentally removed")
150 }
151 if _, ok := client.regTokens["expired"]; ok {
152 t.Errorf("expired token still exists")
153 }
154}
155
156func TestUserAgent(t *testing.T) {
157 client := newTestClient()

Callers

nothing calls this directly

Calls 4

newTestClientFunction · 0.85
cleanupMethod · 0.80
AddMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected