Download this file
| 1 | //go:build linux |
| 2 | |
| 3 | package render |
| 4 | |
| 5 | import ( |
| 6 | "context" |
| 7 | "os" |
| 8 | "path/filepath" |
| 9 | "testing" |
| 10 | |
| 11 | "amadan.net/oficina/equipo/internal/release" |
| 12 | "amadan.net/oficina/equipo/internal/wire" |
| 13 | ) |
| 14 | |
| 15 | // A tree that is not there is the launch's RendererError, and the |
| 16 | // fixture's site and output are removed again. |
| 17 | func TestCheckFixtureRefusesAMissingTree(t *testing.T) { |
| 18 | scratch := tempDir(t) |
| 19 | self, err := os.Executable() |
| 20 | if err != nil { |
| 21 | t.Fatal(err) |
| 22 | } |
| 23 | pin := "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" |
| 24 | cfg := LaunchConfig{Bwrap: "/usr/bin/bwrap", Binary: self, Tree: filepath.Join(scratch, "renderer", pin[:12]), Pin: pin} |
| 25 | err = CheckFixture(context.Background(), cfg, scratch) |
| 26 | if release.RendererHealth(err) != wire.ToolMissing { |
| 27 | t.Fatalf("not missing: %v", err) |
| 28 | } |
| 29 | if left, _ := os.ReadDir(scratch); len(left) != 0 { |
| 30 | t.Fatalf("left in scratch: %v", left) |
| 31 | } |
| 32 | } |
| 33 | |