-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathfrontend_static_asset_guard_test.go
More file actions
46 lines (43 loc) · 1.07 KB
/
Copy pathfrontend_static_asset_guard_test.go
File metadata and controls
46 lines (43 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"os"
"strings"
"testing"
)
// These are configuration drift guard tests: they assert repository hygiene
// markers, not runtime behavior.
func TestRepositoryDoesNotVendorManagementPanelBuildOutput(t *testing.T) {
for _, path := range []string{
"assets",
"manage.html",
"management.html",
"panel-meta.json",
} {
if _, err := os.Stat(path); err == nil {
t.Fatalf("backend repository must not vendor frontend panel build output: %s", path)
} else if !os.IsNotExist(err) {
t.Fatalf("stat %s: %v", path, err)
}
}
}
func TestGeneratedPanelAssetPathsAreIgnoredByGitAndDocker(t *testing.T) {
for _, file := range []string{".gitignore", ".dockerignore"} {
data, err := os.ReadFile(file)
if err != nil {
t.Fatalf("read %s: %v", file, err)
}
content := string(data)
for _, want := range []string{
"assets/",
"manage.html",
"management.html",
"panel-meta.json",
"dist/",
"panel-dist.zip",
} {
if !strings.Contains(content, want) {
t.Fatalf("%s missing generated panel asset ignore pattern %q", file, want)
}
}
}
}