MCPcopy
hub / github.com/github/gh-ost / TestServerCreatePostponeCutOverFlagFile

Function TestServerCreatePostponeCutOverFlagFile

go/logic/server_test.go:72–105  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestServerCreatePostponeCutOverFlagFile(t *testing.T) {
73 t.Parallel()
74
75 t.Run("success", func(t *testing.T) {
76 s := &Server{
77 migrationContext: base.NewMigrationContext(),
78 }
79 dir, err := os.MkdirTemp("", "gh-ost-test-")
80 require.NoError(t, err)
81 defer os.RemoveAll(dir)
82
83 filePath := path.Join(dir, "postpone-cut-over.flag")
84
85 err = s.createPostponeCutOverFlagFile(filePath)
86 require.NoError(t, err)
87 require.FileExists(t, filePath)
88 })
89
90 t.Run("file already exists", func(t *testing.T) {
91 s := &Server{
92 migrationContext: base.NewMigrationContext(),
93 }
94 dir, err := os.MkdirTemp("", "gh-ost-test-")
95 require.NoError(t, err)
96
97 filePath := path.Join(dir, "postpone-cut-over.flag")
98 err = base.TouchFile(filePath)
99 require.NoError(t, err)
100
101 err = s.createPostponeCutOverFlagFile(filePath)
102 require.NoError(t, err)
103 require.FileExists(t, filePath)
104 })
105}

Callers

nothing calls this directly

Calls 3

NewMigrationContextFunction · 0.92
TouchFileFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…