File tree Expand file tree Collapse file tree 4 files changed +53
-28
lines changed
Expand file tree Collapse file tree 4 files changed +53
-28
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -24,7 +24,20 @@ runcmd:
2424 `
2525 _ , err := cloudinit .ParseUser (testYaml )
2626 if err != nil {
27- t .Fatalf ("failed to parse user: %v" , err )
27+ t .Errorf ("failed to parse user: %v" , err )
28+ }
29+
30+ testYaml = `
31+ write_files:
32+ - path: /run/kubeadm/kubeadm.yaml
33+ owner: root:root
34+ permissions: '0640'
35+ content: |
36+ asdfasdfasdf
37+ `
38+ user , err := cloudinit .ParseUser (testYaml )
39+ if err == nil {
40+ t .Errorf ("should returns an error. user=%v" , * user )
2841 }
2942}
3043
Original file line number Diff line number Diff line change 1+ package providerid
2+
3+ import (
4+ "testing"
5+ )
6+
7+ func TestNew (t * testing.T ) {
8+ uuid := ""
9+ providerID , err := New (uuid )
10+ if err == nil {
11+ t .Errorf ("err should not be nil. providerID=%s" , providerID )
12+ }
13+
14+ uuid = "asdf"
15+ providerID , err = New (uuid )
16+ if err != nil {
17+ t .Errorf ("failed to create providerID: %v" , err )
18+ }
19+ }
20+
21+ func TestUUID (t * testing.T ) {
22+ pid := providerID {
23+ uuid : "asdf" ,
24+ }
25+ uuid := pid .UUID ()
26+ if uuid != "asdf" {
27+ t .Errorf ("should be asdf" )
28+ }
29+ }
30+
31+ func TestString (t * testing.T ) {
32+ pid := providerID {
33+ uuid : "asdf" ,
34+ }
35+ uuid := pid .String ()
36+ if uuid != Prefix + "asdf" {
37+ t .Errorf ("should be %sasdf" , Prefix )
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments