Skip to content

Commit 77c81c1

Browse files
authored
JGC-492 - Add e2e test for release bundle --format flag (#3546)
* JGC-492 - Add e2e test for release bundle --format flag * JGC-492 - Assert stable table content to avoid column-wrap flakiness * JGC-492 - Bump jfrog-cli-artifactory to merged master and drop temporary replace
1 parent d5a2b88 commit 77c81c1

3 files changed

Lines changed: 51 additions & 3 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/jfrog/build-info-go v1.13.1-0.20260610071651-260ad6720e0d
2222
github.com/jfrog/gofrog v1.7.6
2323
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260608074325-4de652aef752
24-
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260610074911-82ce7d90edbd
24+
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260617065038-e7be947840da
2525
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260609101026-df3091b39d06
2626
github.com/jfrog/jfrog-cli-evidence v0.9.5-0.20260601141509-8df6c9a4bc9b
2727
github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20260601140139-4cefb6add7b7

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL
406406
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
407407
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260608074325-4de652aef752 h1:Fcb54+kmZjEuBbGstzerLz37Lk6SutfMF7CxLqgXRlE=
408408
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260608074325-4de652aef752/go.mod h1:EeLKgLeJfKcS7671H52bfCgj1xK8wyJJGBRD5a+vJMc=
409-
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260610074911-82ce7d90edbd h1:1AKWhJehl5Z8X69ibX7Azjt70x2L4PnBdnrGiVzdWxY=
410-
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260610074911-82ce7d90edbd/go.mod h1:VqV0Bed11HoBlugAEGa3RumbwnDVslEf0gKocTzLs9s=
409+
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260617065038-e7be947840da h1:BnmMBxYQlJ/WMrVO31q7LumJ5fDLQdIm3MVGNrNDC4w=
410+
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260617065038-e7be947840da/go.mod h1:VqV0Bed11HoBlugAEGa3RumbwnDVslEf0gKocTzLs9s=
411411
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260609101026-df3091b39d06 h1:A8hWKHyvqzGXfWmh+8lXv3waAkim4xiucBfGhl7ZOeQ=
412412
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260609101026-df3091b39d06/go.mod h1:9R90mhbczGXwW5EGlDs7F08ejQU/xdoDhYHMvzBiqgE=
413413
github.com/jfrog/jfrog-cli-evidence v0.9.5-0.20260601141509-8df6c9a4bc9b h1:V0FxnU3xh29y8yJHWymm6rPr1MrjG1DdPQlr3ckImwk=

lifecycle_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,54 @@ func TestPromoteReleaseBundleWithPromotionTypeFlag(t *testing.T) {
491491
assertStatusCompleted(t, lcManager, tests.LcRbName1, number1, "")
492492
}
493493

494+
// TestReleaseBundleFormatFlag verifies the --format flag output of the lifecycle commands:
495+
// - release-bundle-create --format=json emits a JSON confirmation object.
496+
// - release-bundle-promote --format=table renders a summary table.
497+
//
498+
// The release-bundle-promote --format=json (default) path is already covered by promoteRb.
499+
func TestReleaseBundleFormatFlag(t *testing.T) {
500+
cleanCallback := initLifecycleTest(t, signingKeyOptionalArtifactoryMinVersion)
501+
defer cleanCallback()
502+
lcManager := getLcServiceManager(t)
503+
504+
deleteBuilds := uploadBuilds(t)
505+
defer deleteBuilds()
506+
507+
// release-bundle-create --format=json emits a JSON confirmation object.
508+
specFile, err := tests.CreateSpec(tests.LifecycleBuilds12)
509+
assert.NoError(t, err)
510+
createOutput := lcCli.RunCliCmdWithOutput(t, "rbc", tests.LcRbName1, number1,
511+
getOption("spec", specFile),
512+
getOption(cliutils.SigningKey, gpgKeyPairName),
513+
getOption(cliutils.Sync, "true"),
514+
getOption(cliutils.Format, "json"))
515+
defer deleteReleaseBundle(t, lcManager, tests.LcRbName1, number1)
516+
517+
var created struct {
518+
Name string `json:"release_bundle_name"`
519+
Version string `json:"release_bundle_version"`
520+
Status string `json:"status"`
521+
}
522+
assert.NoError(t, json.Unmarshal([]byte(createOutput), &created))
523+
assert.Equal(t, tests.LcRbName1, created.Name)
524+
assert.Equal(t, number1, created.Version)
525+
assert.Equal(t, "created", created.Status)
526+
527+
// release-bundle-promote --format=table renders a summary table.
528+
tableOutput := lcCli.RunCliCmdWithOutput(t, "rbp", tests.LcRbName1, number1, prodEnvironment,
529+
getOption(cliutils.SigningKey, gpgKeyPairName),
530+
getOption(cliutils.IncludeRepos, tests.RtProdRepo1),
531+
"--project=default",
532+
getOption(cliutils.Format, "table"))
533+
// The bundle name column wraps across lines, so assert on stable, non-wrapping
534+
// content: the table title, headers, and the environment value.
535+
assert.Contains(t, tableOutput, "Promotion Result")
536+
assert.Contains(t, tableOutput, "BUNDLE NAME")
537+
assert.Contains(t, tableOutput, "ENVIRONMENT")
538+
assert.Contains(t, tableOutput, prodEnvironment)
539+
assertStatusCompleted(t, lcManager, tests.LcRbName1, number1, "")
540+
}
541+
494542
func TestReleaseBundleCreationWithDraftFlagFromSpec(t *testing.T) {
495543
cleanCallback := initLifecycleTest(t, draftBundleArtifactoryMinVersion)
496544
defer cleanCallback()

0 commit comments

Comments
 (0)