forked from k3s-io/k3s
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to reconcile bootstrap data between datastore and disk (k…
…3s-io#3398) Signed-off-by: Brian Downs <brian.downs@gmail.com>
- Loading branch information
1 parent
586ed94
commit f7e289c
Showing
14 changed files
with
720 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.