Skip to content

Commit

Permalink
Fix server test configuration
Browse files Browse the repository at this point in the history
Previously, tmp boltdb was always created in directory 8080.
  • Loading branch information
paskal committed Dec 2, 2024
1 parent a0c412e commit cd7f616
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/app/cmd/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestServerApp_AnonMode(t *testing.T) {
waitForHTTPServerStart(port)

providers := app.restSrv.Authenticator.Providers()
require.Equal(t, 10+1, len(providers), "extra auth provider for anon")
require.Equal(t, 11+1, len(providers), "extra auth provider for anon")
assert.Equal(t, "anonymous", providers[len(providers)-1].Name(), "anon auth provider")

client := http.Client{Timeout: 10 * time.Second}
Expand Down Expand Up @@ -796,7 +796,6 @@ func prepServerApp(t *testing.T, fn func(o ServerCommand) ServerCommand) (*serve
_, err := p.ParseArgs([]string{"--admin-passwd=password", "--site=remark"})
require.NoError(t, err)
cmd.Avatar.FS.Path, cmd.Avatar.Type, cmd.BackupLocation, cmd.Image.FS.Path = "/tmp/remark42_test", "fs", "/tmp/remark42_test", "/tmp/remark42_test"
cmd.Store.Bolt.Path = fmt.Sprintf("/tmp/%d", cmd.Port)
cmd.Store.Bolt.Timeout = 10 * time.Second
cmd.Auth.Apple.CID, cmd.Auth.Apple.KID, cmd.Auth.Apple.TID = "cid", "kid", "tid"
cmd.Auth.Apple.PrivateKeyFilePath = "testdata/apple.p8"
Expand Down Expand Up @@ -828,7 +827,10 @@ func prepServerApp(t *testing.T, fn func(o ServerCommand) ServerCommand) (*serve
cmd.RestrictedNames = []string{"umputun", "bobuk"}
cmd.emailMsgTemplatePath = "../../templates/email_reply.html.tmpl"
cmd.emailVerificationTemplatePath = "../../templates/email_confirmation_subscription.html.tmpl"

cmd = fn(cmd)
// as is uses port, call it after fn which could set it
cmd.Store.Bolt.Path = fmt.Sprintf("/tmp/%d", cmd.Port)

app, ctx, cancel := createAppFromCmd(t, cmd)

Expand Down

0 comments on commit cd7f616

Please sign in to comment.