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

Side by Side Diff: milo/buildsource/swarming/build_test.go

Issue 2975023002: [milo] remove linkBase and calculate links directly. (Closed)
Patch Set: common url base Created 3 years, 5 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 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package swarming 5 package swarming
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "flag" 9 "flag"
10 "fmt" 10 "fmt"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 }) 59 })
60 60
61 for _, tc := range getTestCases(".") { 61 for _, tc := range getTestCases(".") {
62 bl := BuildLoader{ 62 bl := BuildLoader{
63 logDogClientFunc: logDogClientFunc(tc), 63 logDogClientFunc: logDogClientFunc(tc),
64 } 64 }
65 svc := debugSwarmingService{tc} 65 svc := debugSwarmingService{tc}
66 66
67 fmt.Printf("Generating expectations for %s\n", tc) 67 fmt.Printf("Generating expectations for %s\n", tc)
68 68
69 » » » build, err := bl.SwarmingBuildImpl(c, svc, "foo", tc.nam e) 69 » » » build, err := bl.SwarmingBuildImpl(c, svc, tc.name)
70 if err != nil { 70 if err != nil {
71 panic(fmt.Errorf("Could not run swarmingBuildImp l for %s: %s", tc, err)) 71 panic(fmt.Errorf("Could not run swarmingBuildImp l for %s: %s", tc, err))
72 } 72 }
73 buildJSON, err := json.MarshalIndent(build, "", " ") 73 buildJSON, err := json.MarshalIndent(build, "", " ")
74 if err != nil { 74 if err != nil {
75 panic(fmt.Errorf("Could not JSON marshal %s: %s" , tc.name, err)) 75 panic(fmt.Errorf("Could not JSON marshal %s: %s" , tc.name, err))
76 } 76 }
77 filename := filepath.Join("expectations", tc.name+".json ") 77 filename := filepath.Join("expectations", tc.name+".json ")
78 err = ioutil.WriteFile(filename, []byte(buildJSON), 0644 ) 78 err = ioutil.WriteFile(filename, []byte(buildJSON), 0644 )
79 if err != nil { 79 if err != nil {
(...skipping 21 matching lines...) Expand all
101 } 101 }
102 svc := debugSwarmingService{tc} 102 svc := debugSwarmingService{tc}
103 103
104 // Special case: The build-internal test case to check that ACLs should fail. 104 // Special case: The build-internal test case to check that ACLs should fail.
105 if tc.name == "build-internal" { 105 if tc.name == "build-internal" {
106 Convey("Should fail", func() { 106 Convey("Should fail", func() {
107 c := auth.WithState(c, &authtest .FakeState{ 107 c := auth.WithState(c, &authtest .FakeState{
108 Identity: identity .AnonymousIdentity, 108 Identity: identity .AnonymousIdentity,
109 IdentityGroups: []string {"all"}, 109 IdentityGroups: []string {"all"},
110 }) 110 })
111 » » » » » » _, err := bl.SwarmingBuildImpl(c , svc, "foo", tc.name) 111 » » » » » » _, err := bl.SwarmingBuildImpl(c , svc, tc.name)
112 So(err.Error(), ShouldResemble, "Not a Milo Job or access denied") 112 So(err.Error(), ShouldResemble, "Not a Milo Job or access denied")
113 }) 113 })
114 } 114 }
115 115
116 » » » » build, err := bl.SwarmingBuildImpl(c, svc, "foo" , tc.name) 116 » » » » build, err := bl.SwarmingBuildImpl(c, svc, tc.na me)
117 So(err, ShouldBeNil) 117 So(err, ShouldBeNil)
118 So(build, shouldMatchExpectationsFor, tc.name+". json") 118 So(build, shouldMatchExpectationsFor, tc.name+". json")
119 }) 119 })
120 } 120 }
121 }) 121 })
122 } 122 }
OLDNEW
« no previous file with comments | « milo/buildsource/swarming/build.go ('k') | milo/buildsource/swarming/expectations/build-canceled.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698