Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Unified Diff: ct/go/util/gs_test.go

Issue 1988103002: [CT] Add ability to download to/upload from swarming GS dir with numerical subdirs (Closed) Base URL: https://skia.googlesource.com/buildbot@ct-1-chromium_builds
Patch Set: Fix vet Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ct/go/util/gs.go ('K') | « ct/go/util/gs.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ct/go/util/gs_test.go
diff --git a/ct/go/util/gs_test.go b/ct/go/util/gs_test.go
index b78ac1fa412cabe1e318009dcdf661dd1d12b90f..943a2155fc21ab679db96434e28981dfaee9b8b5 100644
--- a/ct/go/util/gs_test.go
+++ b/ct/go/util/gs_test.go
@@ -135,3 +135,31 @@ func TestAreTimestampsEqual(t *testing.T) {
}
assert.False(t, result4)
}
+
+// Will need a local valid google_storage_token.data file with read write access
+// to run the below test.
+func Auth_TestDownloadSwarmingArtifacts(t *testing.T) {
+ testPagesetsDirName := filepath.Join("unit-tests", "util", "page_sets")
+
+ gs, err := NewGsUtil(nil)
+ assert.Nil(t, err)
+
+ localDir, err := ioutil.TempDir("", "util_test_")
+ assert.Nil(t, err)
+ defer util.RemoveAll(localDir)
+ pageSetToIndex, err := gs.DownloadSwarmingArtifacts(localDir, testPagesetsDirName, "10k", 1, 2)
+ if err != nil {
+ t.Errorf("Unexpected error: %s", err)
+ }
+
+ // Examine contents of returned dictionary.
+ assert.Equal(t, 2, len(pageSetToIndex))
+ assert.Equal(t, 1, pageSetToIndex[filepath.Join(localDir, "1.py")])
+ assert.Equal(t, 2, pageSetToIndex[filepath.Join(localDir, "2.py")])
+ // Examine contents of the local directory.
+ files, err := ioutil.ReadDir(localDir)
+ assert.Nil(t, err)
+ assert.Equal(t, 2, len(files))
+ assert.Equal(t, "1.py", files[0].Name())
+ assert.Equal(t, "2.py", files[1].Name())
+}
« ct/go/util/gs.go ('K') | « ct/go/util/gs.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698