()
| 83 | } |
| 84 | |
| 85 | func (c *CacheTestSuite) TestSetToolsCacheWithError() { |
| 86 | tools := []commonParams.RunnerApplicationDownload{ |
| 87 | { |
| 88 | DownloadURL: garmTesting.Ptr("https://example.com"), |
| 89 | }, |
| 90 | } |
| 91 | c.Require().NotNil(githubToolsCache) |
| 92 | c.Require().Len(githubToolsCache.entities, 0) |
| 93 | SetGithubToolsCache(c.entity, tools) |
| 94 | entity := githubToolsCache.entities[c.entity.ID] |
| 95 | |
| 96 | c.Require().Equal(int64(entity.expiresAt.Sub(entity.updatedAt).Minutes()), int64(60)) |
| 97 | c.Require().Len(githubToolsCache.entities, 1) |
| 98 | SetGithubToolsCacheError(c.entity, runnerErrors.ErrNotFound) |
| 99 | |
| 100 | cachedTools, err := GetGithubToolsCache(c.entity.ID) |
| 101 | c.Require().Error(err) |
| 102 | c.Require().Nil(cachedTools) |
| 103 | } |
| 104 | |
| 105 | func (c *CacheTestSuite) TestSetErrorOnNonExistingCacheEntity() { |
| 106 | entity := params.ForgeEntity{ |
nothing calls this directly
no test coverage detected