Skip to content

Commit 1640954

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

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

artifactory_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3267,6 +3267,39 @@ 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+
// Validate downloaded files
3292+
paths, err := fileutils.ListFilesRecursiveWalkIntoDirSymlink(tests.Out, false)
3293+
assert.NoError(t, err)
3294+
err = tests.ValidateListsIdentical(tests.GetBuildDownload(), paths)
3295+
assert.NoError(t, err)
3296+
3297+
// Cleanup
3298+
inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildNameWithSpaces, artHttpDetails)
3299+
cleanArtifactoryTest()
3300+
}
3301+
3302+
32703303
// Upload a file to 2 different builds.
32713304
// Verify that we don't download files with same sha and build name and different build number.
32723305
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"

0 commit comments

Comments
 (0)