...
1 package labels
2
3 import (
4 "context"
5 "os"
6 "testing"
7
8 "gotest.tools/v3/assert"
9
10 "edge-infra.dev/test/f2"
11 )
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 var f f2.Framework
27
28 func TestMain(m *testing.M) {
29
30
31 f = f2.New(context.Background(), f2.WithExtensions()).
32 WithLabel("test", "label").
33 WithLabel("foo", "bar", "baz", "boo").
34 Flaky().
35 Component("yada").
36 Priviledged("yada").
37 WithID("yada").
38 Slow().
39 Disruptive().
40 Serial()
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 os.Exit(f.Run(m))
56 }
57
58 func TestFeature(t *testing.T) {
59 fin := f2.NewFeature("feature 1").
60 Test("test hey", func(ctx f2.Context, t *testing.T) f2.Context {
61 assert.Assert(t, true)
62 t.Log("in feature 1")
63
64 return ctx
65 }).WithLabel("boo", "hoo").Feature()
66
67
68
69
70
71
72
73 f.Test(t, fin)
74 }
75
76 func TestAnotherFeature(t *testing.T) {
77 fin := f2.NewFeature("feature 2").
78 Test("test hey", func(ctx f2.Context, t *testing.T) f2.Context {
79 assert.Assert(t, true)
80 t.Log("in feature 2")
81
82 return ctx
83 }).WithLabel("boo", "fool").
84 Flaky().
85 Feature()
86
87
88
89
90
91
92 f.Test(t, fin)
93 }
94
View as plain text