How to use BuilderPoll method of dashapi Package

Best Syzkaller code snippet using dashapi.BuilderPoll

fix_test.go

Source:fix_test.go Github

copy

Full Screen

...14 build1 := testBuild(1)15 c.client.UploadBuild(build1)16 crash1 := testCrash(build1, 1)17 c.client.ReportCrash(crash1)18 builderPollResp, _ := c.client.BuilderPoll(build1.Manager)19 c.expectEQ(len(builderPollResp.PendingCommits), 0)20 needRepro, _ := c.client.NeedRepro(testCrashID(crash1))21 c.expectEQ(needRepro, true)22 rep := c.client.pollBug()23 // Specify fixing commit for the bug.24 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{25 ID: rep.ID,26 Status: dashapi.BugStatusOpen,27 FixCommits: []string{"foo: fix the crash"},28 })29 c.expectEQ(reply.OK, true)30 // Don't need repro once there are fixing commits.31 needRepro, _ = c.client.NeedRepro(testCrashID(crash1))32 c.expectEQ(needRepro, false)33 // Check that the commit is now passed to builders.34 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)35 c.expectEQ(len(builderPollResp.PendingCommits), 1)36 c.expectEQ(builderPollResp.PendingCommits[0], "foo: fix the crash")37 // Patches must not be reset on other actions.38 c.client.updateBug(rep.ID, dashapi.BugStatusOpen, "")39 // Upstream commands must fail if patches are already present.40 // Right course of action is unclear in this situation,41 // so this test merely documents the current behavior.42 reply, _ = c.client.ReportingUpdate(&dashapi.BugUpdate{43 ID: rep.ID,44 Status: dashapi.BugStatusUpstream,45 })46 c.expectEQ(reply.OK, false)47 c.client.ReportCrash(crash1)48 c.client.pollBugs(0)49 // Upload another build with the commit present.50 build2 := testBuild(2)51 build2.Manager = build1.Manager52 build2.Commits = []string{"foo: fix the crash"}53 c.client.UploadBuild(build2)54 // Check that the commit is now not passed to this builder.55 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)56 c.expectEQ(len(builderPollResp.PendingCommits), 0)57 // Ensure that a new crash creates a new bug (the old one must be marked as fixed).58 c.client.ReportCrash(crash1)59 rep2 := c.client.pollBug()60 c.expectEQ(rep2.Title, "title1 (2)")61 // Regression test: previously upstreamming failed because the new bug had fixing commits.62 c.client.ReportCrash(crash1)63 c.client.updateBug(rep2.ID, dashapi.BugStatusUpstream, "")64 c.client.pollBug()65}66// Test bug that is fixed by 2 commits.67func TestFixedByTwoCommits(t *testing.T) {68 c := NewCtx(t)69 defer c.Close()70 build1 := testBuild(1)71 c.client.UploadBuild(build1)72 crash1 := testCrash(build1, 1)73 c.client.ReportCrash(crash1)74 builderPollResp, _ := c.client.BuilderPoll(build1.Manager)75 c.expectEQ(len(builderPollResp.PendingCommits), 0)76 rep := c.client.pollBug()77 // Specify fixing commit for the bug.78 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{79 ID: rep.ID,80 Status: dashapi.BugStatusOpen,81 FixCommits: []string{"bar: prepare for fixing", "\"foo: fix the crash\""},82 })83 c.expectEQ(reply.OK, true)84 // Check that the commit is now passed to builders.85 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)86 c.expectEQ(len(builderPollResp.PendingCommits), 2)87 c.expectEQ(builderPollResp.PendingCommits[0], "bar: prepare for fixing")88 c.expectEQ(builderPollResp.PendingCommits[1], "foo: fix the crash")89 // Upload another build with only one of the commits.90 build2 := testBuild(2)91 build2.Manager = build1.Manager92 build2.Commits = []string{"bar: prepare for fixing"}93 c.client.UploadBuild(build2)94 // Check that it has not fixed the bug.95 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)96 c.expectEQ(len(builderPollResp.PendingCommits), 2)97 c.expectEQ(builderPollResp.PendingCommits[0], "bar: prepare for fixing")98 c.expectEQ(builderPollResp.PendingCommits[1], "foo: fix the crash")99 c.client.ReportCrash(crash1)100 c.client.pollBugs(0)101 // Now upload build with both commits.102 build3 := testBuild(3)103 build3.Manager = build1.Manager104 build3.Commits = []string{"foo: fix the crash", "bar: prepare for fixing"}105 c.client.UploadBuild(build3)106 // Check that the commit is now not passed to this builder.107 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)108 c.expectEQ(len(builderPollResp.PendingCommits), 0)109 // Ensure that a new crash creates a new bug (the old one must be marked as fixed).110 c.client.ReportCrash(crash1)111 rep2 := c.client.pollBug()112 c.expectEQ(rep2.Title, "title1 (2)")113}114// A bug is marked as fixed by one commit and then remarked as fixed by another.115func TestReFixed(t *testing.T) {116 c := NewCtx(t)117 defer c.Close()118 build1 := testBuild(1)119 c.client.UploadBuild(build1)120 crash1 := testCrash(build1, 1)121 c.client.ReportCrash(crash1)122 builderPollResp, _ := c.client.BuilderPoll(build1.Manager)123 c.expectEQ(len(builderPollResp.PendingCommits), 0)124 c.advanceTime(time.Hour)125 rep := c.client.pollBug()126 bug, _, _ := c.loadBug(rep.ID)127 c.expectEQ(bug.LastActivity, c.mockedTime)128 c.expectEQ(bug.FixTime, time.Time{})129 // Specify fixing commit for the bug.130 c.advanceTime(time.Hour)131 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{132 ID: rep.ID,133 Status: dashapi.BugStatusOpen,134 FixCommits: []string{"a wrong one"},135 })136 c.expectEQ(reply.OK, true)137 bug, _, _ = c.loadBug(rep.ID)138 c.expectEQ(bug.LastActivity, c.mockedTime)139 c.expectEQ(bug.FixTime, c.mockedTime)140 c.advanceTime(time.Hour)141 reply, _ = c.client.ReportingUpdate(&dashapi.BugUpdate{142 ID: rep.ID,143 Status: dashapi.BugStatusOpen,144 FixCommits: []string{"the right one"},145 })146 c.expectEQ(reply.OK, true)147 bug, _, _ = c.loadBug(rep.ID)148 c.expectEQ(bug.LastActivity, c.mockedTime)149 c.expectEQ(bug.FixTime, c.mockedTime)150 // No updates, just check that LastActivity time is updated, FixTime preserved.151 fixTime := c.mockedTime152 c.advanceTime(time.Hour)153 reply, _ = c.client.ReportingUpdate(&dashapi.BugUpdate{154 ID: rep.ID,155 Status: dashapi.BugStatusOpen,156 })157 c.expectEQ(reply.OK, true)158 bug, _, _ = c.loadBug(rep.ID)159 c.expectEQ(bug.LastActivity, c.mockedTime)160 c.expectEQ(bug.FixTime, fixTime)161 // Send the same fixing commit, check that LastActivity time is updated, FixTime preserved.162 c.advanceTime(time.Hour)163 reply, _ = c.client.ReportingUpdate(&dashapi.BugUpdate{164 ID: rep.ID,165 Status: dashapi.BugStatusOpen,166 FixCommits: []string{"the right one"},167 })168 c.expectEQ(reply.OK, true)169 bug, _, _ = c.loadBug(rep.ID)170 c.expectEQ(bug.LastActivity, c.mockedTime)171 c.expectEQ(bug.FixTime, fixTime)172 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)173 c.expectEQ(len(builderPollResp.PendingCommits), 1)174 c.expectEQ(builderPollResp.PendingCommits[0], "the right one")175 // Upload another build with the wrong commit.176 build2 := testBuild(2)177 build2.Manager = build1.Manager178 build2.Commits = []string{"a wrong one"}179 c.client.UploadBuild(build2)180 // Check that it has not fixed the bug.181 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)182 c.expectEQ(len(builderPollResp.PendingCommits), 1)183 c.expectEQ(builderPollResp.PendingCommits[0], "the right one")184 c.client.ReportCrash(crash1)185 c.client.pollBugs(0)186 // Now upload build with the right commit.187 build3 := testBuild(3)188 build3.Manager = build1.Manager189 build3.Commits = []string{"the right one"}190 c.client.UploadBuild(build3)191 // Check that the commit is now not passed to this builder.192 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)193 c.expectEQ(len(builderPollResp.PendingCommits), 0)194}195// Fixing commit is present on one manager, but missing on another.196func TestFixTwoManagers(t *testing.T) {197 c := NewCtx(t)198 defer c.Close()199 build1 := testBuild(1)200 c.client.UploadBuild(build1)201 crash1 := testCrash(build1, 1)202 c.client.ReportCrash(crash1)203 builderPollResp, _ := c.client.BuilderPoll(build1.Manager)204 c.expectEQ(len(builderPollResp.PendingCommits), 0)205 rep := c.client.pollBug()206 // Specify fixing commit for the bug.207 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{208 ID: rep.ID,209 Status: dashapi.BugStatusOpen,210 FixCommits: []string{"foo: fix the crash"},211 })212 c.expectEQ(reply.OK, true)213 // Now the second manager appears.214 build2 := testBuild(2)215 c.client.UploadBuild(build2)216 // Check that the commit is now passed to builders.217 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)218 c.expectEQ(len(builderPollResp.PendingCommits), 1)219 c.expectEQ(builderPollResp.PendingCommits[0], "foo: fix the crash")220 builderPollResp, _ = c.client.BuilderPoll(build2.Manager)221 c.expectEQ(len(builderPollResp.PendingCommits), 1)222 c.expectEQ(builderPollResp.PendingCommits[0], "foo: fix the crash")223 // Now first manager picks up the commit.224 build3 := testBuild(3)225 build3.Manager = build1.Manager226 build3.Commits = []string{"foo: fix the crash"}227 c.client.UploadBuild(build3)228 // Check that the commit is now not passed to this builder.229 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)230 c.expectEQ(len(builderPollResp.PendingCommits), 0)231 // But still passed to another.232 builderPollResp, _ = c.client.BuilderPoll(build2.Manager)233 c.expectEQ(len(builderPollResp.PendingCommits), 1)234 c.expectEQ(builderPollResp.PendingCommits[0], "foo: fix the crash")235 // Check that the bug is still open.236 c.client.ReportCrash(crash1)237 c.client.pollBugs(0)238 // Now the second manager picks up the commit.239 build4 := testBuild(4)240 build4.Manager = build2.Manager241 build4.Commits = []string{"foo: fix the crash"}242 c.client.UploadBuild(build4)243 // Now the bug must be fixed.244 builderPollResp, _ = c.client.BuilderPoll(build2.Manager)245 c.expectEQ(len(builderPollResp.PendingCommits), 0)246 c.client.ReportCrash(crash1)247 rep2 := c.client.pollBug()248 c.expectEQ(rep2.Title, "title1 (2)")249}250func TestReFixedTwoManagers(t *testing.T) {251 c := NewCtx(t)252 defer c.Close()253 build1 := testBuild(1)254 c.client.UploadBuild(build1)255 crash1 := testCrash(build1, 1)256 c.client.ReportCrash(crash1)257 builderPollResp, _ := c.client.BuilderPoll(build1.Manager)258 c.expectEQ(len(builderPollResp.PendingCommits), 0)259 rep := c.client.pollBug()260 // Specify fixing commit for the bug.261 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{262 ID: rep.ID,263 Status: dashapi.BugStatusOpen,264 FixCommits: []string{"foo: fix the crash"},265 })266 c.expectEQ(reply.OK, true)267 // Now the second manager appears.268 build2 := testBuild(2)269 c.client.UploadBuild(build2)270 // Now first manager picks up the commit.271 build3 := testBuild(3)272 build3.Manager = build1.Manager273 build3.Commits = []string{"foo: fix the crash"}274 c.client.UploadBuild(build3)275 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)276 c.expectEQ(len(builderPollResp.PendingCommits), 0)277 // Now we change the fixing commit.278 reply, _ = c.client.ReportingUpdate(&dashapi.BugUpdate{279 ID: rep.ID,280 Status: dashapi.BugStatusOpen,281 FixCommits: []string{"the right one"},282 })283 c.expectEQ(reply.OK, true)284 // Now it must again appear on both managers.285 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)286 c.expectEQ(len(builderPollResp.PendingCommits), 1)287 c.expectEQ(builderPollResp.PendingCommits[0], "the right one")288 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)289 c.expectEQ(len(builderPollResp.PendingCommits), 1)290 c.expectEQ(builderPollResp.PendingCommits[0], "the right one")291 // Now the second manager picks up the second commit.292 build4 := testBuild(4)293 build4.Manager = build2.Manager294 build4.Commits = []string{"the right one"}295 c.client.UploadBuild(build4)296 // The bug must be still open.297 c.client.ReportCrash(crash1)298 c.client.pollBugs(0)299 // Specify fixing commit again, but it's the same one as before, so nothing changed.300 reply, _ = c.client.ReportingUpdate(&dashapi.BugUpdate{301 ID: rep.ID,302 Status: dashapi.BugStatusOpen,303 FixCommits: []string{"the right one"},304 })305 c.expectEQ(reply.OK, true)306 // Now the first manager picks up the second commit.307 build5 := testBuild(5)308 build5.Manager = build1.Manager309 build5.Commits = []string{"the right one"}310 c.client.UploadBuild(build5)311 // Now the bug must be fixed.312 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)313 c.expectEQ(len(builderPollResp.PendingCommits), 0)314 c.client.ReportCrash(crash1)315 rep2 := c.client.pollBug()316 c.expectEQ(rep2.Title, "title1 (2)")317}318// TestFixedWithCommitTags tests fixing of bugs with Reported-by commit tags.319func TestFixedWithCommitTags(t *testing.T) {320 c := NewCtx(t)321 defer c.Close()322 build1 := testBuild(1)323 c.client.UploadBuild(build1)324 build2 := testBuild(2)325 c.client.UploadBuild(build2)326 crash1 := testCrash(build1, 1)327 c.client.ReportCrash(crash1)328 rep := c.client.pollBug()329 // Upload build with 2 fixing commits for this bug.330 build1.FixCommits = []dashapi.Commit{331 {Title: "fix commit 1", BugIDs: []string{rep.ID}},332 {Title: "fix commit 2", BugIDs: []string{rep.ID}},333 }334 c.client.UploadBuild(build1)335 // Now the commits must be associated with the bug and the second336 // manager must get them as pending.337 builderPollResp, _ := c.client.BuilderPoll(build2.Manager)338 c.expectEQ(len(builderPollResp.PendingCommits), 2)339 c.expectEQ(builderPollResp.PendingCommits[0], "fix commit 1")340 c.expectEQ(builderPollResp.PendingCommits[1], "fix commit 2")341 // The first manager must not get them.342 builderPollResp, _ = c.client.BuilderPoll(build1.Manager)343 c.expectEQ(len(builderPollResp.PendingCommits), 0)344 // The bug is still not fixed.345 c.client.ReportCrash(crash1)346 c.client.pollBugs(0)347 // Now the second manager reports the same commits.348 // This must close the bug.349 build2.FixCommits = build1.FixCommits350 c.client.UploadBuild(build2)351 // Commits must not be passed to managers.352 builderPollResp, _ = c.client.BuilderPoll(build2.Manager)353 c.expectEQ(len(builderPollResp.PendingCommits), 0)354 // Ensure that a new crash creates a new bug.355 c.client.ReportCrash(crash1)356 rep2 := c.client.pollBug()357 c.expectEQ(rep2.Title, "title1 (2)")358}359// TestFixedDup tests Reported-by commit tag that comes for a dup.360// In such case we need to associate it with the canonical bugs.361func TestFixedDup(t *testing.T) {362 c := NewCtx(t)363 defer c.Close()364 build := testBuild(1)365 c.client.UploadBuild(build)366 crash1 := testCrash(build, 1)...

Full Screen

Full Screen

BuilderPoll

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 req.Param("buildername", "buildbot")4 req.Param("project", "go")5 req.Header("Content-Type", "application/json")6 str, err := req.String()7 if err != nil {8 logs.Error(err)9 }10 fmt.Println(str)11}12{"buildernames":["buildbot"],"builders":{"buildbot":{"cachedBuilds":[],"cachedBuildsAreComplete":true,"currentBigState":"idle","currentBuilds":[{"buildid":1,"buildername":"buildbot","number":1,"project":"go","results":0,"started_at":"2018-10-15 14:08:54.596+05:30","state_string":"building"}],"currentSmallState":"building","description":"Buildbot","name":"buildbot","nextBuildNumber":2,"state":1}},"master":{"buildbot":{"cachedBuilds":[],"cachedBuildsAreComplete":true,"currentBigState":"idle","currentBuilds":[{"buildid":1,"buildername":"buildbot","number":1,"project":"go","results":0,"started_at":"2018-10-15 14:08:54.596+05:30","state_string":"building"}],"currentSmallState":"building","description":"Buildbot","name":"buildbot","nextBuildNumber":2,"state":1}}},"project":"go"}13import (14func main() {

Full Screen

Full Screen

BuilderPoll

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 req.Header("Content-Type", "application/json")4 str, err := req.String()5 if err != nil {6 fmt.Println(err)7 }8 fmt.Println(str)9}10import (11func main() {12 req.Header("Content-Type", "application/json")13 str, err := req.String()14 if err != nil {15 fmt.Println(err)16 }17 fmt.Println(str)18}19import (20func main() {21 req.Header("Content-Type", "application/json")22 str, err := req.String()23 if err != nil {24 fmt.Println(err)25 }26 fmt.Println(str)27}28import (29func main() {30 req.Header("Content-Type", "application/json")31 str, err := req.String()32 if err != nil {33 fmt.Println(err)34 }35 fmt.Println(str)36}37import (38func main() {39 req.Header("Content-Type", "application/json")40 str, err := req.String()41 if err != nil {42 fmt.Println(err)43 }44 fmt.Println(str)45}

Full Screen

Full Screen

BuilderPoll

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 var req = httplib.Get(url)4 var resp, err = req.String()5 if err != nil {6 fmt.Println("Error: ", err)7 }8 var builders = []string{}9 json.Unmarshal([]byte(resp), &builders)10 for _, builder := range builders {11 fmt.Println(builder)12 }13 reader := bufio.NewReader(os.Stdin)14 fmt.Print("Enter builder name: ")15 builder, _ := reader.ReadString('16 builder = strings.TrimSuffix(builder, "17 var req = httplib.Post(url)18 var resp, err = req.String()19 if err != nil {20 fmt.Println("Error: ", err)21 }22 fmt.Println(resp)23}24import (25func main() {26 var req = httplib.Get(url)27 var resp, err = req.String()28 if err != nil {29 fmt.Println("Error: ", err)30 }31 var builders = []string{}32 json.Unmarshal([]byte(resp), &builders)33 for _, builder := range builders {34 fmt.Println(builder)35 }36 reader := bufio.NewReader(os.Stdin)37 fmt.Print("Enter builder name: ")38 builder, _ := reader.ReadString('39 builder = strings.TrimSuffix(builder, "40 var req = httplib.Post(url)41 var resp, err = req.String()42 if err != nil {43 fmt.Println("Error: ", err)44 }45 fmt.Println(resp)46}

Full Screen

Full Screen

BuilderPoll

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 if len(os.Args) != 2 {4 fmt.Println("Usage: %s <builder name>", os.Args[0])5 os.Exit(1)6 }7 for {8 builderStatus = dashapi.BuilderPoll(builderName)9 if builderStatus == "idle" {10 }11 time.Sleep(30 * time.Second)12 }13 fmt.Println(builderStatus)14}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful