Rework the Destination filesystem to make --renderStaticToDisk work

See #9626
This commit is contained in:
Bjørn Erik Pedersen 2022-03-21 09:35:15 +01:00
parent b08193971a
commit d070bdf10f
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
75 changed files with 651 additions and 566 deletions

View file

@ -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