package labels import ( "context" "os" "testing" "gotest.tools/v3/assert" "edge-infra.dev/test/f2" ) // check the BUILD.bazel file for a list of args you can comment/uncomment // to see different results based off the labels and skip-labels flags // you could also comment out all of the args in BUILD.bazel and run the same // commands via flags // ex: bazel test //test/f2/examples/labels/... --test_arg=--labels=boo=hoo // another method is using test/config.json // ex: // { // "labels": "boo=hoo" // } var f f2.Framework func TestMain(m *testing.M) { // you can add labels at the framework or the feature level // any label added to the framework will also be added to the feature f = f2.New(context.Background(), f2.WithExtensions()). WithLabel("test", "label"). // custom labels can have a single value WithLabel("foo", "bar", "baz", "boo"). // or a list of values Flaky(). // or use a predefined label Component("yada"). Priviledged("yada"). WithID("yada"). Slow(). Disruptive(). Serial() // list of labels defined on the framework: // map[ // component:yada // disruptive:true // flaky:true // foo:bar,baz,boo // id:yada // priviledged:yada // serial:true // slow:true // test:label // ] os.Exit(f.Run(m)) } func TestFeature(t *testing.T) { fin := f2.NewFeature("feature 1"). Test("test hey", func(ctx f2.Context, t *testing.T) f2.Context { assert.Assert(t, true) t.Log("in feature 1") return ctx }).WithLabel("boo", "hoo").Feature() // list of labels defined on the feature: // map[ // boo:hoo // ... all of the framework labels // ] f.Test(t, fin) } func TestAnotherFeature(t *testing.T) { fin := f2.NewFeature("feature 2"). Test("test hey", func(ctx f2.Context, t *testing.T) f2.Context { assert.Assert(t, true) t.Log("in feature 2") return ctx }).WithLabel("boo", "fool"). Flaky(). // the flaky label is ignored since the framework already defines it Feature() // list of labels defined on the feature: // map[ // boo:fool // ... all of the framework labels // ] f.Test(t, fin) }