MCPcopy Create free account
hub / github.com/coder/envbuilder / TestMain

Function TestMain

integration/integration_test.go:2602–2625  ·  view source on GitHub ↗

TestMain runs before all tests to build the envbuilder image.

(m *testing.M)

Source from the content-addressed store, hash-verified

2600
2601// TestMain runs before all tests to build the envbuilder image.
2602func TestMain(m *testing.M) {
2603 checkTestRegistry()
2604 cleanOldEnvbuilders()
2605 ctx := context.Background()
2606 // Run the build script to create the envbuilder image.
2607 cmd := exec.CommandContext(ctx, "../scripts/build.sh")
2608 rdr, wtr := io.Pipe()
2609 defer rdr.Close()
2610 defer wtr.Close()
2611 cmd.Stdout = wtr
2612 cmd.Stderr = wtr
2613 go func() {
2614 scanner := bufio.NewScanner(rdr)
2615 for scanner.Scan() {
2616 fmt.Println(scanner.Text())
2617 }
2618 }()
2619 err := cmd.Run()
2620 if err != nil {
2621 panic(err)
2622 }
2623
2624 m.Run()
2625}
2626
2627func checkTestRegistry() {
2628 resp, err := http.Get("http://localhost:5000/v2/_catalog")

Callers

nothing calls this directly

Calls 3

checkTestRegistryFunction · 0.85
cleanOldEnvbuildersFunction · 0.85
CloseMethod · 0.80

Tested by

no test coverage detected