this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test that empty events make it through (#414)

quick test to make sure empty events get handled properly

authored by

Whyrusleeping and committed by
GitHub
58769477 3c04f0d0

+42
+4
pds/server.go
··· 727 727 728 728 return nil 729 729 } 730 + 731 + func (s *Server) Repoman() *repomgr.RepoManager { 732 + return s.repoman 733 + }
+38
testing/integ_test.go
··· 399 399 t.Fatal("should have failed with a 400") 400 400 } 401 401 } 402 + 403 + func TestBGSHandleEmptyEvent(t *testing.T) { 404 + if testing.Short() { 405 + t.Skip("skipping BGS test in 'short' test mode") 406 + } 407 + assert := assert.New(t) 408 + didr := TestPLC(t) 409 + p1 := MustSetupPDS(t, ".tpds", didr) 410 + p1.Run(t) 411 + 412 + b1 := MustSetupBGS(t, didr) 413 + b1.Run(t) 414 + 415 + b1.tr.TrialHosts = []string{p1.RawHost()} 416 + 417 + p1.RequestScraping(t, b1) 418 + 419 + time.Sleep(time.Millisecond * 50) 420 + 421 + evts := b1.Events(t, -1) 422 + defer evts.Cancel() 423 + 424 + bob := p1.MustNewUser(t, "bob.tpds") 425 + fmt.Println("event 1") 426 + e1 := evts.Next() 427 + assert.NotNil(e1.RepoCommit) 428 + assert.Equal(e1.RepoCommit.Repo, bob.DID()) 429 + 430 + ctx := context.TODO() 431 + rm := p1.server.Repoman() 432 + if err := rm.BatchWrite(ctx, 1, nil); err != nil { 433 + t.Fatal(err) 434 + } 435 + 436 + e2 := evts.Next() 437 + assert.Equal(len(e2.RepoCommit.Ops), 0) 438 + assert.Equal(e2.RepoCommit.Repo, bob.DID()) 439 + }