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

Upload - Add timezone to each zip file before uploading #2103

Merged
merged 4 commits into from
Sep 27, 2023
Merged
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
33 changes: 33 additions & 0 deletions artifactory_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"archive/zip"
"bytes"
"crypto/tls"
"encoding/csv"
Expand Down Expand Up @@ -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()
Expand Down
Loading