()
| 116 | } |
| 117 | |
| 118 | func (c *CacheTestSuite) TestTimedOutToolsCache() { |
| 119 | tools := []commonParams.RunnerApplicationDownload{ |
| 120 | { |
| 121 | DownloadURL: garmTesting.Ptr("https://example.com"), |
| 122 | }, |
| 123 | } |
| 124 | |
| 125 | c.Require().NotNil(githubToolsCache) |
| 126 | c.Require().Len(githubToolsCache.entities, 0) |
| 127 | SetGithubToolsCache(c.entity, tools) |
| 128 | entity := githubToolsCache.entities[c.entity.ID] |
| 129 | |
| 130 | c.Require().Equal(int64(entity.expiresAt.Sub(entity.updatedAt).Minutes()), int64(60)) |
| 131 | c.Require().Len(githubToolsCache.entities, 1) |
| 132 | entity = githubToolsCache.entities[c.entity.ID] |
| 133 | entity.updatedAt = entity.updatedAt.Add(-3 * time.Hour) |
| 134 | entity.expiresAt = entity.updatedAt.Add(-2 * time.Hour) |
| 135 | githubToolsCache.entities[c.entity.ID] = entity |
| 136 | |
| 137 | cachedTools, err := GetGithubToolsCache(c.entity.ID) |
| 138 | c.Require().Error(err) |
| 139 | c.Require().Nil(cachedTools) |
| 140 | } |
| 141 | |
| 142 | func (c *CacheTestSuite) TestGetInexistentCache() { |
| 143 | c.Require().NotNil(githubToolsCache) |
nothing calls this directly
no test coverage detected