-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport bootstrap engine 1.21 (#4314)
- Loading branch information
1 parent
ee64cac
commit 45c5d78
Showing
14 changed files
with
721 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package bootstrap | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/rancher/k3s/pkg/daemons/config" | ||
) | ||
|
||
func TestObjToMap(t *testing.T) { | ||
type args struct { | ||
obj interface{} | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want map[string]string | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "Minimal Valid", | ||
args: args{ | ||
obj: &config.ControlRuntimeBootstrap{ | ||
ServerCA: "/var/lib/rancher/k3s/server/tls/server-ca.crt", | ||
ServerCAKey: "/var/lib/rancher/k3s/server/tls/server-ca.key", | ||
}, | ||
}, | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "Minimal Invalid", | ||
args: args{ | ||
obj: 1, | ||
}, | ||
wantErr: true, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
_, err := ObjToMap(tt.args.obj) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("ObjToMap() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.