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
|
package config_test
import (
"testing"
"github.com/stretchr/testify/assert"
"phabricator.wikimedia.org/source/blubber/build"
"phabricator.wikimedia.org/source/blubber/config"
)
func TestBuilderConfigYAML(t *testing.T) {
cfg, err := config.ReadConfig([]byte(`---
version: v2
base: foo
variants:
build:
builder: [make, -f, Makefile]`))
if assert.NoError(t, err) {
variant, err := config.ExpandVariant(cfg, "build")
assert.Equal(t, []string{"make", "-f", "Makefile"}, variant.Builder)
assert.Nil(t, err)
}
}
func TestBuilderConfigInstructions(t *testing.T) {
cfg := config.BuilderConfig{Builder: []string{"make", "-f", "Makefile"}}
t.Run("PhasePostInstall", func(t *testing.T) {
assert.Equal(t,
[]build.Instruction{
build.Run{
"make",
[]string{"-f", "Makefile"},
},
},
cfg.InstructionsForPhase(build.PhasePostInstall),
)
})
}
|