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

Side by Side Diff: ct/go/util/util_test.go

Issue 1990873002: Use swarming in create_pagesets CT task (Closed) Base URL: https://skia.googlesource.com/buildbot@ct-3-swarming-timeouts
Patch Set: Remove TODOs 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 unified diff | Download patch
OLDNEW
1 package util 1 package util
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "io/ioutil" 5 "io/ioutil"
6 "os" 6 "os"
7 "path/filepath" 7 "path/filepath"
8 "strconv" 8 "strconv"
9 "strings"
9 "testing" 10 "testing"
10 11
11 "go.skia.org/infra/go/util" 12 "go.skia.org/infra/go/util"
12 ) 13 )
13 14
14 import ( 15 import (
15 assert "github.com/stretchr/testify/require" 16 assert "github.com/stretchr/testify/require"
16 ) 17 )
17 18
18 const ( 19 const (
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 // Assert error returned when specified dir does not exist. 80 // Assert error returned when specified dir does not exist.
80 nonexistantDir := filepath.Join(os.TempDir(), "util_test_nonexistant") 81 nonexistantDir := filepath.Join(os.TempDir(), "util_test_nonexistant")
81 util.RemoveAll(nonexistantDir) 82 util.RemoveAll(nonexistantDir)
82 if err := CreateTimestampFile(nonexistantDir); err != nil { 83 if err := CreateTimestampFile(nonexistantDir); err != nil {
83 // Expected error 84 // Expected error
84 } else { 85 } else {
85 t.Error("Unexpected lack of error") 86 t.Error("Unexpected lack of error")
86 } 87 }
87 } 88 }
89
90 func TestGetStartRange(t *testing.T) {
91 assert.Equal(t, 1, GetStartRange(1, 1000))
92 assert.Equal(t, 2001, GetStartRange(3, 1000))
93 assert.Equal(t, 41, GetStartRange(3, 20))
94 }
95
96 func TestGetPathToPyFiles(t *testing.T) {
97 swarmingPath := GetPathToPyFiles(true)
98 assert.True(t, strings.HasSuffix(swarmingPath, filepath.Join("src", "go. skia.org", "infra", "ct", "py")))
99 nonSwarmingPath := GetPathToPyFiles(false)
100 assert.True(t, strings.HasSuffix(nonSwarmingPath, filepath.Join("src", " go.skia.org", "infra", "ct", "py")))
101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698