Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Added test case for --build-name with spaces #2850

Draft
wants to merge 1 commit into
base: v2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions artifactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3267,6 +3267,33 @@ func TestArtifactoryDownloadByShaAndBuild(t *testing.T) {
cleanArtifactoryTest()
}

func TestArtifactoryUploadWithBuildNameWithSpaces(t *testing.T) {
initArtifactoryTest(t, "")

buildNumber := "1"

// Delete the build if it already exists
inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildNameWithSpaces, artHttpDetails)

// Upload a file with build name containing spaces
runRt(t, "upload", "testdata/a/a1.in", tests.RtRepo1+"/data/a1.in",
"--build-name="+tests.RtBuildNameWithSpaces, "--build-number="+buildNumber)

// Publish build info
runRt(t, "build-publish", tests.RtBuildNameWithSpaces, buildNumber)

// Validate that the file was uploaded successfully
specFile, err := tests.CreateSpec(tests.BuildDownloadSpecNoBuildNumber)
assert.NoError(t, err)

runRt(t, "download", "--spec="+specFile)

// Cleanup
inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.RtBuildNameWithSpaces, artHttpDetails)
cleanArtifactoryTest()
}


// Upload a file to 2 different builds.
// Verify that we don't download files with same sha and build name and different build number.
func TestArtifactoryDownloadByShaAndBuildName(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions utils/tests/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ var (
PipenvBuildName = "cli-pipenv-build"
RtBuildName1 = "cli-rt-build1"
RtBuildName2 = "cli-rt-build2"
RtBuildNameWithSpaces = "cli build with spaces"
RtBuildNameWithSpecialChars = "cli-rt-a$+~&^a#-build3"
RtPermissionTargetName = "cli-rt-pt"
LcBuildName1 = "cli-lc-build1"
Expand Down
1 change: 1 addition & 0 deletions utils/tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ func AddTimestampToGlobalVars() {
PipenvBuildName += uniqueSuffix
RtBuildName1 += uniqueSuffix
RtBuildName2 += uniqueSuffix
RtBuildNameWithSpaces += uniqueSuffix
RtBuildNameWithSpecialChars += uniqueSuffix
RtPermissionTargetName += uniqueSuffix
LcBuildName1 += uniqueSuffix
Expand Down
Loading