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

Commit

Permalink
#59 allow updating *-SNAPSHOT tags/manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
hjacobs committed Nov 9, 2015
1 parent 7e54d6f commit d544813
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
1 change: 0 additions & 1 deletion resources/db/v2.sql
Expand Up @@ -35,7 +35,6 @@ UPDATE tags
WHERE t_team = :team
AND t_artifact = :artifact
AND t_name = :name
AND t_image_id != :image
AND t_manifest != :manifest;

-- name: get-manifest
Expand Down
30 changes: 29 additions & 1 deletion test/org/zalando/stups/pierone/v2_test.clj
Expand Up @@ -19,7 +19,10 @@
digest "sha256:a5c741c7dea3a96944022b4b9a0b1480cfbeef5f4cc934850e8afacb48e18c5e"
invalid-manifest (.getBytes "stuff")
manifest (str "{\"fsLayers\":[{\"blobSum\":\"" digest "\"}]}")
manifest-bytes (.getBytes manifest)]
manifest-bytes (.getBytes manifest)
; manifest2 is simply a different manifest (we use the same FS layer twice, does not make sense, but works)
manifest2 (str "{\"fsLayers\":[{\"blobSum\":\"" digest "\"},{\"blobSum\":\"" digest "\"}]}")
manifest2-bytes (.getBytes manifest2)]

(u/wipe-db system)

Expand Down Expand Up @@ -95,5 +98,30 @@
(client/get (u/v1-url "/images/" digest "/json")
(u/http-opts)))

; check that *-SNAPSHOT tags are mutable
(expect 200
(client/put (u/v2-url "/myteam/myart/manifests/1.0-SNAPSHOT")
(u/http-opts (io/input-stream manifest-bytes))))

; works, no changes
(expect 200
(client/put (u/v2-url "/myteam/myart/manifests/1.0-SNAPSHOT")
(u/http-opts (io/input-stream manifest-bytes))))

(is (= manifest
(expect 200
(client/get (u/v2-url "/myteam/myart/manifests/1.0-SNAPSHOT")
(u/http-opts)))))

; update, new manifest
(expect 200
(client/put (u/v2-url "/myteam/myart/manifests/1.0-SNAPSHOT")
(u/http-opts (io/input-stream manifest2-bytes))))

(is (= manifest2
(expect 200
(client/get (u/v2-url "/myteam/myart/manifests/1.0-SNAPSHOT")
(u/http-opts)))))

; stop
(component/stop system)))

0 comments on commit d544813

Please sign in to comment.