mirror of
https://github.com/rancher/k3k.git
synced 2026-04-10 20:57:18 +00:00
* bump virtual-kubelet and k8s * bump controller-manager * fix upgrade-downgrade * fix kubernetes version * Update tests_suite_test.go * removed direct dep of yaml.v2, bump etcd modules
47 lines
878 B
Go
47 lines
878 B
Go
package agent
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
func Test_virtualAgentData(t *testing.T) {
|
|
type args struct {
|
|
serviceIP string
|
|
token string
|
|
}
|
|
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
expectedData map[string]string
|
|
}{
|
|
{
|
|
name: "simple config",
|
|
args: args{
|
|
serviceIP: "10.0.0.21",
|
|
token: "dnjklsdjnksd892389238",
|
|
},
|
|
expectedData: map[string]string{
|
|
"server": "https://10.0.0.21",
|
|
"token": "dnjklsdjnksd892389238",
|
|
"with-node-id": "true",
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
config := virtualAgentData(tt.args.serviceIP, tt.args.token)
|
|
|
|
data := make(map[string]string)
|
|
err := yaml.Unmarshal([]byte(config), data)
|
|
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, tt.expectedData, data)
|
|
})
|
|
}
|
|
}
|