Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Refresh all the repos #470

Merged
merged 1 commit into from
Jun 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/data/cache/auto_refresher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ func TestNewRefreshDataError(t *testing.T) {
job := NewRefreshChartsData(chartsImplementation, freshness, "test-run", true)
assert.Equal(t, job.FirstRun(), true, "First run")
err := job.Do()
assert.ExistsErr(t, err, "Error executing refresh")
assert.NoErr(t, err)
}
6 changes: 5 additions & 1 deletion src/api/data/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ func (c *cachedCharts) Refresh() error {
for _, repo := range repos {
charts, err := repohelper.GetChartsFromRepoIndexFile(repo)
if err != nil {
return err
log.WithFields(log.Fields{
"repo": repo,
"error": err,
}).Error("error on refresh charts from repo")
continue
}

// 3 - Process elements in index
Expand Down
5 changes: 4 additions & 1 deletion src/api/data/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ func TestCachedChartsRefreshErrorPropagation(t *testing.T) {
chImplementation := NewCachedCharts(models.NewMockSession(models.MockDBConfig{}))
models.MockRepos = tt.repos
err := chImplementation.Refresh()
assert.ExistsErr(t, err, tt.name)
assert.NoErr(t, err)
allCharts, err := chImplementation.All()
assert.NoErr(t, err)
assert.True(t, len(allCharts) == 0, "empty charts slice")
})
}
}
Expand Down