How to use ReportingUpdate method of dashapi Package

Best Syzkaller code snippet using dashapi.ReportingUpdate

fix_test.go

Source:fix_test.go Github

copy

Full Screen

...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)...

Full Screen

Full Screen

reporting_test.go

Source:reporting_test.go Github

copy

Full Screen

...78 want.ReproSyzLink = externalLink(c.ctx, textReproSyz, dbCrash.ReproSyz)79 want.LogLink = externalLink(c.ctx, textCrashLog, dbCrash.Log)80 want.ReportLink = externalLink(c.ctx, textCrashReport, dbCrash.Report)81 c.expectEQ(want, rep1)82 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{83 ID: rep.ID,84 Status: dashapi.BugStatusOpen,85 ReproLevel: dashapi.ReproLevelSyz,86 })87 c.expectEQ(reply.OK, true)88 // After bug update should not get the report again.89 c.client.pollBugs(0)90 // Now close the bug in the first reporting.91 c.client.updateBug(rep.ID, dashapi.BugStatusUpstream, "")92 // Check that bug updates for the first reporting fail now.93 reply, _ = c.client.ReportingUpdate(&dashapi.BugUpdate{ID: rep.ID, Status: dashapi.BugStatusOpen})94 c.expectEQ(reply.OK, false)95 // Report another crash with syz repro for this bug,96 // ensure that we report the new crash in the next reporting.97 crash1.Report = []byte("report2")98 c.client.ReportCrash(crash1)99 // Check that we get the report in the second reporting.100 rep2 := c.client.pollBug()101 c.expectNE(rep2.ID, "")102 c.expectNE(rep2.ID, rep.ID)103 want.Type = dashapi.ReportNew104 want.ID = rep2.ID105 want.Report = []byte("report2")106 want.LogLink = rep2.LogLink107 want.ReportLink = rep2.ReportLink108 want.CrashID = rep2.CrashID109 want.ReproSyzLink = rep2.ReproSyzLink110 want.Link = fmt.Sprintf("https://testapp.appspot.com/bug?extid=%v", rep2.ID)111 want.CreditEmail = fmt.Sprintf("syzbot+%v@testapp.appspotmail.com", rep2.ID)112 want.First = true113 want.Moderation = false114 want.Config = []byte(`{"Index":2}`)115 want.NumCrashes = 3116 c.expectEQ(want, rep2)117 // Check that that we can't upstream the bug in the final reporting.118 reply, _ = c.client.ReportingUpdate(&dashapi.BugUpdate{119 ID: rep2.ID,120 Status: dashapi.BugStatusUpstream,121 })122 c.expectEQ(reply.OK, false)123}124func TestInvalidBug(t *testing.T) {125 c := NewCtx(t)126 defer c.Close()127 build := testBuild(1)128 c.client.UploadBuild(build)129 crash1 := testCrashWithRepro(build, 1)130 c.client.ReportCrash(crash1)131 rep := c.client.pollBug()132 c.expectEQ(rep.Title, "title1")133 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{134 ID: rep.ID,135 Status: dashapi.BugStatusOpen,136 ReproLevel: dashapi.ReproLevelC,137 })138 c.expectEQ(reply.OK, true)139 {140 closed, _ := c.client.ReportingPollClosed([]string{rep.ID, "foobar"})141 c.expectEQ(len(closed), 0)142 }143 // Mark the bug as invalid.144 c.client.updateBug(rep.ID, dashapi.BugStatusInvalid, "")145 {146 closed, _ := c.client.ReportingPollClosed([]string{rep.ID, "foobar"})147 c.expectEQ(len(closed), 1)148 c.expectEQ(closed[0], rep.ID)149 }150 // Now it should not be reported in either reporting.151 c.client.pollBugs(0)152 // Now a similar crash happens again.153 crash2 := &dashapi.Crash{154 BuildID: "build1",155 Title: "title1",156 Log: []byte("log2"),157 Report: []byte("report2"),158 ReproC: []byte("int main() { return 1; }"),159 }160 c.client.ReportCrash(crash2)161 // Now it should be reported again.162 rep = c.client.pollBug()163 c.expectNE(rep.ID, "")164 _, dbCrash, dbBuild := c.loadBug(rep.ID)165 want := &dashapi.BugReport{166 Type: dashapi.ReportNew,167 Namespace: "test1",168 Config: []byte(`{"Index":1}`),169 ID: rep.ID,170 OS: "linux",171 Arch: "amd64",172 VMArch: "amd64",173 First: true,174 Moderation: true,175 Title: "title1 (2)",176 Link: fmt.Sprintf("https://testapp.appspot.com/bug?extid=%v", rep.ID),177 CreditEmail: fmt.Sprintf("syzbot+%v@testapp.appspotmail.com", rep.ID),178 CompilerID: "compiler1",179 KernelRepo: "repo1",180 KernelRepoAlias: "repo1 branch1",181 KernelBranch: "branch1",182 KernelCommit: "1111111111111111111111111111111111111111",183 KernelCommitTitle: build.KernelCommitTitle,184 KernelCommitDate: buildCommitDate,185 KernelConfig: []byte("config1"),186 KernelConfigLink: externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig),187 Log: []byte("log2"),188 LogLink: externalLink(c.ctx, textCrashLog, dbCrash.Log),189 Report: []byte("report2"),190 ReportLink: externalLink(c.ctx, textCrashReport, dbCrash.Report),191 ReproC: []byte("int main() { return 1; }"),192 ReproCLink: externalLink(c.ctx, textReproC, dbCrash.ReproC),193 CrashID: rep.CrashID,194 NumCrashes: 1,195 HappenedOn: []string{"repo1 branch1"},196 }197 c.expectEQ(want, rep)198 c.client.ReportFailedRepro(testCrashID(crash1))199}200func TestReportingQuota(t *testing.T) {201 c := NewCtx(t)202 defer c.Close()203 build := testBuild(1)204 c.client.UploadBuild(build)205 const numReports = 8 // quota is 3 per day206 for i := 0; i < numReports; i++ {207 c.client.ReportCrash(testCrash(build, i))208 }209 for _, reports := range []int{3, 3, 2, 0, 0} {210 c.advanceTime(24 * time.Hour)211 c.client.pollBugs(reports)212 // Out of quota for today, so must get 0 reports.213 c.client.pollBugs(0)214 }215}216// Basic dup scenario: mark one bug as dup of another.217func TestReportingDup(t *testing.T) {218 c := NewCtx(t)219 defer c.Close()220 build := testBuild(1)221 c.client.UploadBuild(build)222 crash1 := testCrash(build, 1)223 c.client.ReportCrash(crash1)224 crash2 := testCrash(build, 2)225 c.client.ReportCrash(crash2)226 reports := c.client.pollBugs(2)227 rep1 := reports[0]228 rep2 := reports[1]229 // Dup.230 c.client.updateBug(rep2.ID, dashapi.BugStatusDup, rep1.ID)231 {232 // Both must be reported as open.233 closed, _ := c.client.ReportingPollClosed([]string{rep1.ID, rep2.ID})234 c.expectEQ(len(closed), 0)235 }236 // Undup.237 c.client.updateBug(rep2.ID, dashapi.BugStatusOpen, "")238 // Dup again.239 c.client.updateBug(rep2.ID, dashapi.BugStatusDup, rep1.ID)240 // Dup crash happens again, new bug must not be created.241 c.client.ReportCrash(crash2)242 c.client.pollBugs(0)243 // Now close the original bug, and check that new bugs for dup are now created.244 c.client.updateBug(rep1.ID, dashapi.BugStatusInvalid, "")245 {246 // Now both must be reported as closed.247 closed, _ := c.client.ReportingPollClosed([]string{rep1.ID, rep2.ID})248 c.expectEQ(len(closed), 2)249 c.expectEQ(closed[0], rep1.ID)250 c.expectEQ(closed[1], rep2.ID)251 }252 c.client.ReportCrash(crash2)253 rep3 := c.client.pollBug()254 c.expectEQ(rep3.Title, crash2.Title+" (2)")255 // Unduping after the canonical bugs was closed must not work256 // (we already created new bug for this report).257 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{258 ID: rep2.ID,259 Status: dashapi.BugStatusOpen,260 })261 c.expectEQ(reply.OK, false)262}263// Dup bug onto a closed bug.264// A new crash report must create a new bug.265func TestReportingDupToClosed(t *testing.T) {266 c := NewCtx(t)267 defer c.Close()268 build := testBuild(1)269 c.client.UploadBuild(build)270 crash1 := testCrash(build, 1)271 c.client.ReportCrash(crash1)272 crash2 := testCrash(build, 2)273 c.client.ReportCrash(crash2)274 reports := c.client.pollBugs(2)275 c.client.updateBug(reports[0].ID, dashapi.BugStatusInvalid, "")276 c.client.updateBug(reports[1].ID, dashapi.BugStatusDup, reports[0].ID)277 c.client.ReportCrash(crash2)278 rep2 := c.client.pollBug()279 c.expectEQ(rep2.Title, crash2.Title+" (2)")280}281// Test that marking dups across reporting levels is not permitted.282func TestReportingDupCrossReporting(t *testing.T) {283 c := NewCtx(t)284 defer c.Close()285 build := testBuild(1)286 c.client.UploadBuild(build)287 crash1 := testCrash(build, 1)288 c.client.ReportCrash(crash1)289 crash2 := testCrash(build, 2)290 c.client.ReportCrash(crash2)291 reports := c.client.pollBugs(2)292 rep1 := reports[0]293 rep2 := reports[1]294 // Upstream second bug.295 c.client.updateBug(rep2.ID, dashapi.BugStatusUpstream, "")296 rep3 := c.client.pollBug()297 {298 closed, _ := c.client.ReportingPollClosed([]string{rep1.ID, rep2.ID, rep3.ID})299 c.expectEQ(len(closed), 1)300 c.expectEQ(closed[0], rep2.ID)301 }302 // Duping must fail all ways.303 cmds := []*dashapi.BugUpdate{304 {ID: rep1.ID, DupOf: rep1.ID},305 {ID: rep1.ID, DupOf: rep2.ID},306 {ID: rep2.ID, DupOf: rep1.ID},307 {ID: rep2.ID, DupOf: rep2.ID},308 {ID: rep2.ID, DupOf: rep3.ID},309 {ID: rep3.ID, DupOf: rep1.ID},310 {ID: rep3.ID, DupOf: rep2.ID},311 {ID: rep3.ID, DupOf: rep3.ID},312 }313 for _, cmd := range cmds {314 t.Logf("duping %v -> %v", cmd.ID, cmd.DupOf)315 cmd.Status = dashapi.BugStatusDup316 reply, _ := c.client.ReportingUpdate(cmd)317 c.expectEQ(reply.OK, false)318 }319 // Special case of cross-reporting duping:320 cmd := &dashapi.BugUpdate{321 Status: dashapi.BugStatusDup,322 ID: rep1.ID,323 DupOf: rep3.ID,324 }325 t.Logf("duping %v -> %v", cmd.ID, cmd.DupOf)326 reply, _ := c.client.ReportingUpdate(cmd)327 c.expectTrue(reply.OK)328}329// Test that dups can't form a cycle.330// The test builds cycles of length 1..4.331func TestReportingDupCycle(t *testing.T) {332 c := NewCtx(t)333 defer c.Close()334 build := testBuild(1)335 c.client.UploadBuild(build)336 const N = 4337 reps := make([]*dashapi.BugReport, N)338 for i := 0; i < N; i++ {339 t.Logf("*************** %v ***************", i)340 c.client.ReportCrash(testCrash(build, i))341 reps[i] = c.client.pollBug()342 replyError := "Can't dup bug to itself."343 if i != 0 {344 replyError = "Setting this dup would lead to a bug cycle, cycles are not allowed."345 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{346 Status: dashapi.BugStatusDup,347 ID: reps[i-1].ID,348 DupOf: reps[i].ID,349 })350 c.expectEQ(reply.OK, true)351 }352 reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{353 Status: dashapi.BugStatusDup,354 ID: reps[i].ID,355 DupOf: reps[0].ID,356 })357 c.expectEQ(reply.OK, false)358 c.expectEQ(reply.Error, false)359 c.expectEQ(reply.Text, replyError)360 c.advanceTime(24 * time.Hour)361 }362}363func TestReportingFilter(t *testing.T) {364 c := NewCtx(t)365 defer c.Close()366 build := testBuild(1)...

Full Screen

Full Screen

ReportingUpdate

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 edgerc, err := client.Edgerc("~/.edgerc", "default")4 if err != nil {5 fmt.Println(err)6 }7 client.Init(edgerc)8 dashapi := dash.New()9 reportingUpdate, err := dashapi.ReportingUpdate(10 if err != nil {11 fmt.Println(err)12 }13 fmt.Println(reportingUpdate)14}15{16}17{18}

Full Screen

Full Screen

ReportingUpdate

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 config, err := edgegrid.Init("~/.edgerc", "default")4 if err != nil {5 fmt.Println("Error: ", err)6 }7 client := edgegrid.Client{8 }

Full Screen

Full Screen

ReportingUpdate

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 if err != nil {4 panic(err)5 }6 defer conn.Close()

Full Screen

Full Screen

ReportingUpdate

Using AI Code Generation

copy

Full Screen

1import "fmt"2import "github.com/kr/pretty"3import "github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1"4import "github.com/akamai/AkamaiOPEN-edgegrid-golang/dash-v2"5func main() {6 config, err := akamai.GetEdgegridConfig("~/.edgerc", "default")7 if err != nil {8 fmt.Println("Error: ", err)9 }10 client.Init(config)11 dashapi := dash.New(config)12 reportingUpdate := dash.NewReportingUpdate()

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