-
-
Notifications
You must be signed in to change notification settings - Fork 268
Expand file tree
/
Copy pathmountebank_test.go
More file actions
45 lines (37 loc) · 988 Bytes
/
mountebank_test.go
File metadata and controls
45 lines (37 loc) · 988 Bytes
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
// Copyright © 2026 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package examples_test
import (
"fmt"
"net/http"
"testing"
"time"
"github.com/ory/dockertest/v4"
)
func TestMountebank(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
pool := dockertest.NewPoolT(t, "")
mb := pool.RunT(t, "bbyars/mountebank",
dockertest.WithTag("2.9.1"),
dockertest.WithCmd([]string{"--allowInjection"}),
dockertest.WithoutReuse(),
)
adminURL := fmt.Sprintf("http://%s", mb.GetHostPort("2525/tcp"))
err := pool.Retry(t.Context(), 30*time.Second, func() error {
resp, err := http.Get(adminURL + "/imposters")
if err != nil {
return err
}
resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("mountebank not ready: status %d", resp.StatusCode)
}
return nil
})
if err != nil {
t.Fatalf("Could not connect to Mountebank: %v", err)
}
t.Logf("Mountebank admin API available at %s", adminURL)
}