Skip to content

Commit bc35a71

Browse files
committed
test: run the server package in make test
The shutdown tests live in ./server, which make test (and therefore CI) did not run. The pre-existing TLS valid-cert test is skipped when the untracked dev certificate is absent, so the package passes in CI.
1 parent ef1ef2d commit bc35a71

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ update-ui:
3131

3232
test:
3333
$(GO) test $(TEST_FLAGS) ./database
34+
$(GO) test $(TEST_FLAGS) ./server
3435
$(GO) test $(TEST_FLAGS) ./test/api
3536
$(GO) test $(TEST_FLAGS) ./test/postgrest
3637
$(GO) test $(TEST_FLAGS) ./test/recursive

server/http_server_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package server
22

3-
import "testing"
3+
import (
4+
"os"
5+
"testing"
6+
)
47

58
// A configured-but-unloadable TLS certificate must be a hard error, not a silent
69
// fall-through to plaintext HTTP (which would expose Bearer tokens and login
@@ -14,6 +17,9 @@ func TestLoadTLSConfigFailsClosed(t *testing.T) {
1417

1518
// The dev certificate in the repo root should load into a usable TLS config.
1619
func TestLoadTLSConfigValidCert(t *testing.T) {
20+
if _, err := os.Stat("../localhost.pem"); os.IsNotExist(err) {
21+
t.Skip("dev certificate not present (generate with mkcert localhost)")
22+
}
1723
cfg, err := loadTLSConfig("../localhost.pem", "../localhost-key.pem")
1824
if err != nil {
1925
t.Fatalf("expected valid cert to load, got: %v", err)

0 commit comments

Comments
 (0)