-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe2e_test.go
82 lines (68 loc) · 1.7 KB
/
e2e_test.go
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//go:build e2e
// +build e2e
package main_test
import (
"os"
"testing"
"github.com/pyroscope-io/ci/cmd"
"github.com/rogpeppe/go-internal/testscript"
)
// Make the pyroscope-ci binary available to the testscripts
func TestMain(m *testing.M) {
exitCode := testscript.RunMain(m, map[string]func() int{
"pyroscope-ci": func() int {
err := cmd.RootCmd()
// https://pkg.go.dev/github.com/rogpeppe/go-internal/testscript#RunMain
if err != nil {
return 1
}
return 0
},
})
os.Exit(exitCode)
}
func TestNodeJest(t *testing.T) {
containerName, cleanupProxy := StartProxy(t)
t.Cleanup(cleanupProxy)
testscript.Run(t, testscript.Params{
Setup: Setup(
SetProxyAddressEnvVar(containerName),
BuildImage("./examples/nodejs/jest", "example-nodejs"),
),
Dir: "./examples/nodejs/jest",
})
}
func TestNodeMocha(t *testing.T) {
containerName, cleanupProxy := StartProxy(t)
t.Cleanup(cleanupProxy)
testscript.Run(t, testscript.Params{
Setup: Setup(
SetProxyAddressEnvVar(containerName),
BuildImage("./examples/nodejs/mocha", "example-mocha"),
),
Dir: "./examples/nodejs/mocha",
})
}
func TestGo(t *testing.T) {
containerName, cleanupProxy := StartProxy(t)
t.Cleanup(cleanupProxy)
testscript.Run(t, testscript.Params{
Setup: Setup(
CopyFilesToCwd("./examples/go"),
SetProxyAddressEnvVar(containerName),
BuildImage("./examples/go", "example-go"),
),
Dir: "./examples/go",
})
}
func TestRubyRspec(t *testing.T) {
containerName, cleanupProxy := StartProxy(t)
t.Cleanup(cleanupProxy)
testscript.Run(t, testscript.Params{
Setup: Setup(
SetProxyAddressEnvVar(containerName),
BuildImage("./examples/ruby/rspec", "ruby-rspec"),
),
Dir: "./examples/ruby/rspec",
})
}