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

Side by Side Diff: ct/go/poller/poller_test.go

Issue 1704713002: Fix issue security issue in Gold (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Fixed poller_test Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | go/util/http.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package main 1 package main
2 2
3 import ( 3 import (
4 "database/sql" 4 "database/sql"
5 "fmt" 5 "fmt"
6 "io/ioutil" 6 "io/ioutil"
7 "net/http" 7 "net/http"
8 "os" 8 "os"
9 "path/filepath" 9 "path/filepath"
10 "regexp" 10 "regexp"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // Test that updateWebappTaskSetFailed returns an error when the server response indicates an error. 364 // Test that updateWebappTaskSetFailed returns an error when the server response indicates an error.
365 func TestUpdateWebappTaskSetFailedFailure(t *testing.T) { 365 func TestUpdateWebappTaskSetFailedFailure(t *testing.T) {
366 errstr := "You must be at least this tall to ride this ride." 366 errstr := "You must be at least this tall to ride this ride."
367 task := pendingRecreateWebpageArchivesTask() 367 task := pendingRecreateWebpageArchivesTask()
368 reqCount := 0 368 reqCount := 0
369 mockServer := func(w http.ResponseWriter, r *http.Request) { 369 mockServer := func(w http.ResponseWriter, r *http.Request) {
370 reqCount++ 370 reqCount++
371 assert.Equal(t, "/"+ctfeutil.UPDATE_RECREATE_WEBPAGE_ARCHIVES_TA SK_POST_URI, 371 assert.Equal(t, "/"+ctfeutil.UPDATE_RECREATE_WEBPAGE_ARCHIVES_TA SK_POST_URI,
372 r.URL.Path) 372 r.URL.Path)
373 defer skutil.Close(r.Body) 373 defer skutil.Close(r.Body)
374 » » skutil.ReportError(w, r, fmt.Errorf(errstr), "") 374 » » skutil.ReportError(w, r, fmt.Errorf(errstr), errstr)
375 } 375 }
376 defer frontend.CloseTestServer(frontend.InitTestServer(http.HandlerFunc( mockServer))) 376 defer frontend.CloseTestServer(frontend.InitTestServer(http.HandlerFunc( mockServer)))
377 err := updateWebappTaskSetFailed(&task) 377 err := updateWebappTaskSetFailed(&task)
378 assert.Error(t, err) 378 assert.Error(t, err)
379 assert.Contains(t, err.Error(), errstr) 379 assert.Contains(t, err.Error(), errstr)
380 assert.Equal(t, 1, reqCount) 380 assert.Equal(t, 1, reqCount)
381 } 381 }
382 382
383 func TestDoWorkerHealthCheck(t *testing.T) { 383 func TestDoWorkerHealthCheck(t *testing.T) {
384 mockExec := exec.CommandCollector{} 384 mockExec := exec.CommandCollector{}
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 pollAndExecOnce() 511 pollAndExecOnce()
512 pollAndExecOnce() 512 pollAndExecOnce()
513 pollAndExecOnce() 513 pollAndExecOnce()
514 // Expect three polls. 514 // Expect three polls.
515 expect.Equal(t, 3, mockServer.OldestPendingTaskReqCount()) 515 expect.Equal(t, 3, mockServer.OldestPendingTaskReqCount())
516 // Expect no commands. 516 // Expect no commands.
517 expect.Empty(t, mockExec.Commands()) 517 expect.Empty(t, mockExec.Commands())
518 // No updates expected. 518 // No updates expected.
519 expect.Empty(t, mockServer.UpdateTaskReqs()) 519 expect.Empty(t, mockServer.UpdateTaskReqs())
520 } 520 }
OLDNEW
« no previous file with comments | « no previous file | go/util/http.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698