| 154 | } |
| 155 | |
| 156 | func TestCreateRemovePublicGraceful(t *testing.T) { |
| 157 | is := is.New(t) |
| 158 | ctx := context.Background() |
| 159 | dir := t.TempDir() |
| 160 | td := testdir.New(dir) |
| 161 | err := td.Write(ctx) |
| 162 | is.NoErr(err) |
| 163 | cli := testcli.New(dir) |
| 164 | is.NoErr(td.NotExists(".gitignore")) |
| 165 | result, err := cli.Run(ctx, "create", dir) |
| 166 | is.NoErr(err) |
| 167 | is.Equal(result.Stdout(), "") |
| 168 | is.In(result.Stderr(), "Ready") |
| 169 | |
| 170 | // Start the app |
| 171 | app, err := cli.Start(ctx, "run") |
| 172 | is.NoErr(err) |
| 173 | |
| 174 | // Test the favicon |
| 175 | res, err := app.Get("/favicon.ico") |
| 176 | is.NoErr(err) |
| 177 | is.Equal(res.Status(), 200) |
| 178 | is.NoErr(td.Exists("public/favicon.ico")) |
| 179 | |
| 180 | // Remove the public directory |
| 181 | is.NoErr(os.RemoveAll(filepath.Join(dir, "public"))) |
| 182 | is.NoErr(td.NotExists("bud/public")) |
| 183 | |
| 184 | // Wait for the app to recover |
| 185 | readyCtx, cancel := context.WithTimeout(ctx, 15*time.Second) |
| 186 | is.NoErr(app.Ready(readyCtx)) |
| 187 | cancel() |
| 188 | |
| 189 | res, err = app.Get("/favicon.ico") |
| 190 | is.NoErr(err) |
| 191 | is.Equal(res.Status(), 404) |
| 192 | |
| 193 | is.NoErr(app.Close()) |
| 194 | } |
| 195 | |
| 196 | func TestReleaseVersionOk(t *testing.T) { |
| 197 | if versions.Bud == "latest" { |