MCPcopy
hub / github.com/cloudflare/tableflip / TestUpgraderReady

Function TestUpgraderReady

upgrader_test.go:384–419  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

382}
383
384func TestUpgraderReady(t *testing.T) {
385 t.Parallel()
386
387 u := newTestUpgrader(Options{})
388 defer u.Stop()
389
390 new, errs := u.upgradeProc(t)
391
392 _, exited, err := new.notify()
393 if err != nil {
394 t.Fatal("Can't notify Upgrader:", err)
395 }
396
397 if err := <-errs; err != nil {
398 t.Fatal("Expected Upgrade to return nil when child is ready")
399 }
400
401 select {
402 case <-u.Exit():
403 default:
404 t.Error("Expected Exit() to be closed when upgrade is done")
405 }
406
407 // Simulate the process exiting
408 file := <-u.exitFd
409 file.file.Close()
410
411 select {
412 case err := <-exited:
413 if err != nil {
414 t.Error("exit error", err)
415 }
416 case <-time.After(time.Second):
417 t.Error("Child wasn't notified of parent exiting")
418 }
419}
420
421func TestUpgraderShutdownCancelsUpgrade(t *testing.T) {
422 t.Parallel()

Callers

nothing calls this directly

Calls 5

newTestUpgraderFunction · 0.85
upgradeProcMethod · 0.80
notifyMethod · 0.80
StopMethod · 0.65
ExitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…