forked from marpaia/chef-golang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cookbook_test.go
48 lines (44 loc) · 969 Bytes
/
cookbook_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
package chef
import (
"testing"
)
func TestGetCookbooks(t *testing.T) {
chef := testConnectionWrapper(t)
cookbooks, err := chef.GetCookbooks()
if err != nil {
t.Error(err)
}
found := false
config := testConfig()
for cookbook := range cookbooks {
if cookbook == config.RequiredCookbook.Name {
found = true
break
}
}
if !found {
t.Error("Couldn't find required cookbook")
}
}
func TestGetCookbook(t *testing.T) {
chef := testConnectionWrapper(t)
config := testConfig()
_, ok, err := chef.GetCookbook(config.RequiredCookbook.Name)
if !ok {
t.Error("Couldn't find required cookbook")
}
if err != nil {
t.Error("Couldn't find required cookbook")
}
}
func TestCookbookVersion(t *testing.T) {
chef := testConnectionWrapper(t)
config := testConfig()
_, ok, err := chef.GetCookbookVersion(config.RequiredCookbook.Name, config.RequiredCookbook.Version)
if !ok {
t.Error(err)
}
if !ok {
t.Error("Cookbook version not found")
}
}