This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.go
50 lines (42 loc) · 1.44 KB
/
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
package main
import (
"context"
"time"
"github.com/grafana/scribe/pipeline"
"github.com/grafana/scribe/state"
)
var (
ArgumentTestResultBackend = state.NewBoolArgument("backend-test-result")
ArgumentTestResultFrontend = state.NewBoolArgument("frontend-test-result")
)
func actionTestFrontend(ctx context.Context, opts pipeline.ActionOpts) error {
opts.Logger.Infoln("Testing frontend...")
time.Sleep(time.Second * 1)
opts.Logger.Infoln("Done testing frontend")
// make test-frontend
// assume it passed...
return opts.State.SetBool(ctx, ArgumentTestResultFrontend, true)
}
func actionTestBackend(ctx context.Context, opts pipeline.ActionOpts) error {
opts.Logger.Infoln("Testing backend...")
time.Sleep(time.Second * 1)
opts.Logger.Infoln("Done testing backend")
// go test ./...
// assume it passed...
return opts.State.SetBool(ctx, ArgumentTestResultBackend, true)
}
var stepTestBackend = pipeline.NamedStep("test backend", actionTestBackend).
Provides(ArgumentTestResultBackend).
Requires(ArgumentGoDependencies)
var stepTestFrontend = pipeline.NamedStep("test frontend", actionTestFrontend).
Provides(ArgumentTestResultFrontend).
Requires(ArgumentNodeDependencies)
var PipelineTest = Pipeline{
Name: "test",
Steps: []pipeline.Step{
stepTestBackend,
stepTestFrontend,
},
Requires: []state.Argument{ArgumentNodeDependencies, ArgumentGoDependencies},
Provides: []state.Argument{ArgumentTestResultFrontend, ArgumentTestResultBackend},
}