From d1104bd5b55d58e84e30b8995d1c4eab75b09f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 13 Mar 2024 13:50:00 +0000 Subject: [PATCH] internal/e2e: test that we can't replace published versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were pretty sure that registry.cue.works already forbade this, but we didn't have a proper end-to-end test for it yet. Signed-off-by: Daniel Martí Change-Id: If17d595480771be0c5678edeb36ef97af986d172 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1178252 Unity-Result: CUE porcuepine Reviewed-by: Paul Jolly TryBot-Result: CUEcueckoo --- .../testdata/script/github_app_public.txtar | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/internal/e2e/testdata/script/github_app_public.txtar b/internal/e2e/testdata/script/github_app_public.txtar index 772547231..e47797da5 100644 --- a/internal/e2e/testdata/script/github_app_public.txtar +++ b/internal/e2e/testdata/script/github_app_public.txtar @@ -23,11 +23,30 @@ cmp stdout export.golden # TODO(mvdan): Use another registry token without access to this private repo # and check that they can list and fetch, but not publish, any versions. +# Trying to publish the same version again with the same contents should succeed. +cd ../publish +exec cue mod publish ${VERSION} + +# Trying to publish the same version again with different contents should fail. +# TODO: Note that the error does say the repository has enabled tag immutability, +# but that error message comes from Google Cloud, not from our registry service, +# so it's not a stable string. We should give the user a short and stable error, +# and test for it here with a regular expression. +cd ../publish-different +exec cue mod init ${MODVER} +! exec cue mod publish ${VERSION} +stderr 'cannot tag.*400 Bad Request' + -- publish/foo.cue -- package publish foo: "foo value" +-- publish-different/foo.cue -- +package publish + +foo: "different foo value" + -- depend/out_foo.cue -- package depend