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

Unified Diff: go/src/infra/appengine/test-results/frontend/upload_test.go

Issue 2355353002: Return 409 error when uploading build with same number again (Closed)
Patch Set: Fix Created 4 years, 3 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
« no previous file with comments | « go/src/infra/appengine/test-results/frontend/upload.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/appengine/test-results/frontend/upload_test.go
diff --git a/go/src/infra/appengine/test-results/frontend/upload_test.go b/go/src/infra/appengine/test-results/frontend/upload_test.go
index e4e933f1443e743c0ff85f71fa0a2e0dc560fd7e..b464697d66c96a8a81b08a156fc3bb7974fb728a 100644
--- a/go/src/infra/appengine/test-results/frontend/upload_test.go
+++ b/go/src/infra/appengine/test-results/frontend/upload_test.go
@@ -260,3 +260,38 @@ func TestUpdateIncremental(t *testing.T) {
})
})
}
+
+func TestUses409ResponseCodeForBuildNumberConflict(t *testing.T) {
+ t.Parallel()
+
+ Convey("Return HTTP response code 409 for build with same number", t, func() {
+ ctx := memory.Use(context.Background())
+ testFileIdx, err := datastore.FindAndParseIndexYAML(
+ filepath.Join("testdata"))
+ if err != nil {
+ panic(err)
+ }
+ datastore.GetTestable(ctx).AddIndexes(testFileIdx...)
+ datastore.GetTestable(ctx).CatchupIndexes()
+
+ ctx = SetUploadParams(ctx, &UploadParams{
+ Master: "foo",
+ Builder: "bar",
+ TestType: "baz",
+ })
+ data, err := ioutil.ReadFile(
+ filepath.Join("testdata", "full_results_0.json"))
+ data = bytes.TrimSpace(data)
+ So(err, ShouldBeNil)
+
+ So(updateFullResults(ctx, bytes.NewReader(data)), ShouldBeNil)
+
+ // Ensure that the file is saved in datastore. See http://crbug.com/648817.
+ datastore.GetTestable(ctx).CatchupIndexes()
+
+ err = updateFullResults(ctx, bytes.NewReader(data))
+ se, ok := err.(statusError)
+ So(ok, ShouldBeTrue)
+ So(se.code, ShouldEqual, 409)
+ })
+}
« no previous file with comments | « go/src/infra/appengine/test-results/frontend/upload.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698