diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-03-21 09:35:15 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-04-08 13:26:17 +0200 |
commit | d070bdf10f14d233288f7318a4e9f7555f070a65 (patch) | |
tree | fff8d59f98bdab3027bb45c4e10ca88594332872 /commands/server_test.go | |
parent | b08193971a821fc27e549a73120c15e5e5186775 (diff) |
Rework the Destination filesystem to make --renderStaticToDisk work
See #9626
Diffstat (limited to 'commands/server_test.go')
-rw-r--r-- | commands/server_test.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/commands/server_test.go b/commands/server_test.go index 6972bbe69..ea50afd94 100644 --- a/commands/server_test.go +++ b/commands/server_test.go @@ -77,6 +77,9 @@ func TestServerFlags(t *testing.T) { {"--renderToDisk", func(c *qt.C, r serverTestResult) { assertPublic(c, r, true) }}, + {"--renderStaticToDisk", func(c *qt.C, r serverTestResult) { + assertPublic(c, r, true) + }}, } { c.Run(test.flag, func(c *qt.C) { config := ` @@ -105,9 +108,7 @@ type serverTestResult struct { } func runServerTest(c *qt.C, getHome bool, config string, args ...string) (result serverTestResult) { - dir, clean, err := createSimpleTestSite(c, testSiteConfig{configTOML: config}) - defer clean() - c.Assert(err, qt.IsNil) + dir := createSimpleTestSite(c, testSiteConfig{configTOML: config}) sp, err := helpers.FindAvailablePort() c.Assert(err, qt.IsNil) @@ -141,12 +142,15 @@ func runServerTest(c *qt.C, getHome bool, config string, args ...string) (result time.Sleep(567 * time.Millisecond) resp, err := http.Get(fmt.Sprintf("http://localhost:%d/", port)) c.Check(err, qt.IsNil) + c.Check(resp.StatusCode, qt.Equals, http.StatusOK) if err == nil { defer resp.Body.Close() result.homeContent = helpers.ReaderToString(resp.Body) } } + time.Sleep(1 * time.Second) + select { case <-stop: case stop <- true: @@ -191,7 +195,7 @@ func TestFixURL(t *testing.T) { t.Run(test.TestName, func(t *testing.T) { b := newCommandsBuilder() s := b.newServerCmd() - v := config.New() + v := config.NewWithTestDefaults() baseURL := test.CLIBaseURL v.Set("baseURL", test.CfgBaseURL) s.serverAppend = test.AppendPort |