Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
jobs: fixed crono job when a repository could not be found
Browse files Browse the repository at this point in the history
Fixes #720

Signed-off-by: Miquel Sabaté Solà <[email protected]>
  • Loading branch information
mssola committed Feb 10, 2016
1 parent 0e38cd6 commit efc33be
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/jobs/catalog_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def update_registry!(catalog)
Rails.logger.debug "skip upload not finished repo #{r["name"]}"
else
repository = Repository.create_or_update!(r)
dangling_repos.delete repository.id
dangling_repos.delete repository.id unless repository.nil?
end
end

Expand Down
18 changes: 18 additions & 0 deletions spec/jobs/catalog_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ def update_registry!(catalog)
tags = repo.tags
expect(tags.map(&:name)).to match_array(["latest"])
end

it "handles registries even if there some namespaces missing" do
registry = create(:registry, "hostname" => "registry.test.lan")

VCR.use_cassette("registry/get_registry_catalog_namespace_missing", record: :none) do
job = CatalogJobMock.new
job.perform
end

repos = Repository.all
expect(repos.count).to be 1
repo = repos[0]
expect(repo.name).to eq "busybox"
expect(repo.namespace.id).to eq registry.namespaces.first.id
tags = repo.tags
expect(tags.map(&:name)).to match_array(["latest"])
end

end

describe "Database already filled with repos" do
Expand Down
199 changes: 199 additions & 0 deletions spec/vcr_cassettes/registry/get_registry_catalog_namespace_missing.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit efc33be

Please sign in to comment.