diff --git a/artifactory_test.go b/artifactory_test.go index bda9e3736..1ec968a82 100644 --- a/artifactory_test.go +++ b/artifactory_test.go @@ -1,6 +1,7 @@ package main import ( + "archive/zip" "bytes" "crypto/tls" "encoding/csv" @@ -4166,6 +4167,38 @@ func TestUploadDeploymentViewWithArchive(t *testing.T) { cleanArtifactoryTest() } +func TestUploadZipAndCheckDeploymentViewWithArchive(t *testing.T) { + initArtifactoryTest(t, "") + + // Create tmp dir + assert.NoError(t, os.Mkdir(tests.Out, 0755)) + wd, err := os.Getwd() + assert.NoError(t, err) + defer cleanArtifactoryTest() + chdirCallback := clientTestUtils.ChangeDirWithCallback(t, wd, tests.Out) + defer chdirCallback() + + // Create file and a zip + fileName := "dummy_file.txt" + zipName := "test.zip" + assert.NoError(t, os.WriteFile(fileName, nil, 0644)) + + // Upload & download zip file + assert.NoError(t, artifactoryCli.Exec("upload", fileName, path.Join(tests.RtRepo1, zipName), "--archive", "zip")) + assert.NoError(t, artifactoryCli.Exec("download", path.Join(tests.RtRepo1, zipName))) + + // Check for time-zone offset for each file in the zip + r, err := zip.OpenReader(zipName) + assert.NoError(t, err) + defer func() { assert.NoError(t, r.Close()) }() + _, sysTimezoneOffset := time.Now().Zone() + for _, file := range r.File { + _, fileTimezoneOffset := file.Modified.Zone() + assert.Equal(t, sysTimezoneOffset, fileTimezoneOffset) + } + +} + func TestUploadDetailedSummary(t *testing.T) { initArtifactoryTest(t, "") uploadCmd := generic.NewUploadCommand()