-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuildx_test.go
More file actions
42 lines (35 loc) · 917 Bytes
/
buildx_test.go
File metadata and controls
42 lines (35 loc) · 917 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
package test
import (
"os"
"os/exec"
"testing"
"github.com/moby/buildkit-bench/util/testutil"
"github.com/stretchr/testify/require"
)
func TestBuildx(t *testing.T) {
testutil.Run(t, testutil.TestFuncs(
testBuildxVersion,
))
}
func BenchmarkBuildx(b *testing.B) {
testutil.Run(b, testutil.BenchFuncs(
benchmarkBuildxVersion,
benchmarkBuildxSize,
))
}
func testBuildxVersion(t *testing.T, sb testutil.Sandbox) {
output, err := exec.Command(sb.BuildxBin(), "version").Output()
require.NoError(t, err)
t.Log(string(output))
}
func benchmarkBuildxVersion(b *testing.B, sb testutil.Sandbox) {
b.StartTimer()
err := exec.Command(sb.BuildxBin(), "version").Run()
b.StopTimer()
require.NoError(b, err)
}
func benchmarkBuildxSize(b *testing.B, sb testutil.Sandbox) {
fi, err := os.Stat(sb.BuildxBin())
require.NoError(b, err)
testutil.ReportMetric(b, float64(fi.Size()), testutil.MetricBytes)
}