fix unit tests
This commit is contained in:
@@ -32,7 +32,7 @@ func TestClone(t *testing.T) {
|
||||
Secret: secret.Static(nil),
|
||||
Environ: provider.Static(nil),
|
||||
}
|
||||
args := Args{
|
||||
args := runtime.CompilerArgs{
|
||||
Repo: &drone.Repo{},
|
||||
Build: &drone.Build{},
|
||||
Stage: &drone.Stage{},
|
||||
@@ -57,7 +57,7 @@ func TestClone(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
got := c.Compile(nocontext, args)
|
||||
got := c.Compile(nocontext, args).(*engine.Spec)
|
||||
ignore := cmpopts.IgnoreFields(engine.Step{}, "Envs", "Labels")
|
||||
if diff := cmp.Diff(got.Steps, want, ignore); len(diff) != 0 {
|
||||
t.Errorf(diff)
|
||||
@@ -70,7 +70,7 @@ func TestCloneDisable(t *testing.T) {
|
||||
Registry: registry.Static(nil),
|
||||
Secret: secret.Static(nil),
|
||||
}
|
||||
args := Args{
|
||||
args := runtime.CompilerArgs{
|
||||
Repo: &drone.Repo{},
|
||||
Build: &drone.Build{},
|
||||
Stage: &drone.Stage{},
|
||||
@@ -79,7 +79,7 @@ func TestCloneDisable(t *testing.T) {
|
||||
Manifest: &manifest.Manifest{},
|
||||
Pipeline: &resource.Pipeline{Clone: manifest.Clone{Disable: true}},
|
||||
}
|
||||
got := c.Compile(nocontext, args)
|
||||
got := c.Compile(nocontext, args).(*engine.Spec)
|
||||
if len(got.Steps) != 0 {
|
||||
t.Errorf("Expect no clone step added when disabled")
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ func TestCompile_Secrets(t *testing.T) {
|
||||
"my_username": "octocat",
|
||||
}),
|
||||
}
|
||||
args := Args{
|
||||
args := runtime.CompilerArgs{
|
||||
Repo: &drone.Repo{},
|
||||
Build: &drone.Build{},
|
||||
Stage: &drone.Stage{},
|
||||
@@ -118,7 +118,7 @@ func TestCompile_Secrets(t *testing.T) {
|
||||
Secret: secret.Static(nil),
|
||||
}
|
||||
|
||||
ir := compiler.Compile(nocontext, args)
|
||||
ir := compiler.Compile(nocontext, args).(*engine.Spec)
|
||||
got := ir.Steps[0].Secrets
|
||||
want := []*engine.Secret{
|
||||
{
|
||||
@@ -169,7 +169,7 @@ func testCompile(t *testing.T, source, golden string) *engine.Spec {
|
||||
"my_username": "octocat",
|
||||
}),
|
||||
}
|
||||
args := Args{
|
||||
args := runtime.CompilerArgs{
|
||||
Repo: &drone.Repo{},
|
||||
Build: &drone.Build{Target: "master"},
|
||||
Stage: &drone.Stage{},
|
||||
@@ -203,7 +203,7 @@ func testCompile(t *testing.T, source, golden string) *engine.Spec {
|
||||
t.Errorf(diff)
|
||||
}
|
||||
|
||||
return got
|
||||
return got.(*engine.Spec)
|
||||
}
|
||||
|
||||
func dump(v interface{}) {
|
||||
|
||||
Reference in New Issue
Block a user