Skip to content

Commit 28ad1cc

Browse files
agrasthnagrasthn
authored andcommitted
Added test case for --build-name with spaces
1 parent 8800f64 commit 28ad1cc

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

artifactory_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3267,6 +3267,33 @@ func TestArtifactoryDownloadByShaAndBuild(t *testing.T) {
32673267
cleanArtifactoryTest()
32683268
}
32693269

3270+
func TestArtifactoryUploadWithBuildNameWithSpaces(t *testing.T) {
3271+
initArtifactoryTest(t, "")
3272+
3273+
buildNumber := "1"
3274+
3275+
// Delete the build if it already exists
3276+
inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildNameWithSpaces, artHttpDetails)
3277+
3278+
// Upload a file with build name containing spaces
3279+
runRt(t, "upload", "testdata/a/a1.in", tests.RtRepo1+"/data/a1.in",
3280+
"--build-name="+tests.RtBuildNameWithSpaces, "--build-number="+buildNumber)
3281+
3282+
// Publish build info
3283+
runRt(t, "build-publish", tests.RtBuildNameWithSpaces, buildNumber)
3284+
3285+
// Validate that the file was uploaded successfully
3286+
specFile, err := tests.CreateSpec(tests.BuildDownloadSpecNoBuildNumber)
3287+
assert.NoError(t, err)
3288+
3289+
runRt(t, "download", "--spec="+specFile)
3290+
3291+
// Cleanup
3292+
inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildNameWithSpaces, artHttpDetails)
3293+
cleanArtifactoryTest()
3294+
}
3295+
3296+
32703297
// Upload a file to 2 different builds.
32713298
// Verify that we don't download files with same sha and build name and different build number.
32723299
func TestArtifactoryDownloadByShaAndBuildName(t *testing.T) {

utils/tests/consts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ var (
221221
PipenvBuildName = "cli-pipenv-build"
222222
RtBuildName1 = "cli-rt-build1"
223223
RtBuildName2 = "cli-rt-build2"
224+
RtBuildNameWithSpaces = "cli build with spaces"
224225
RtBuildNameWithSpecialChars = "cli-rt-a$+~&^a#-build3"
225226
RtPermissionTargetName = "cli-rt-pt"
226227
LcBuildName1 = "cli-lc-build1"

utils/tests/utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ func AddTimestampToGlobalVars() {
512512
PipenvBuildName += uniqueSuffix
513513
RtBuildName1 += uniqueSuffix
514514
RtBuildName2 += uniqueSuffix
515+
RtBuildNameWithSpaces += uniqueSuffix
515516
RtBuildNameWithSpecialChars += uniqueSuffix
516517
RtPermissionTargetName += uniqueSuffix
517518
LcBuildName1 += uniqueSuffix

0 commit comments

Comments
 (0)