38 lines
738 B
Go
38 lines
738 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestBase64Decode(t *testing.T) {
|
|
decode := Base64Decode("blljUk45MXIuX2hq")
|
|
|
|
fmt.Println(decode)
|
|
}
|
|
func TestBase64Encode(t *testing.T) {
|
|
encode := Base64Encode("RB6Vfzs7XdC2")
|
|
|
|
fmt.Println(encode)
|
|
}
|
|
|
|
func TestGetRandomString(t *testing.T) {
|
|
for i := 0; i < 10; i++ {
|
|
randomString := GenerateRandomString(10, true)
|
|
fmt.Printf("id: %d randomString: %s\n", i, randomString)
|
|
}
|
|
}
|
|
|
|
func TestGetRandomMySQLPassword(t *testing.T) {
|
|
|
|
rootPassword := GenerateRandomString(12, false)
|
|
rootPasswordBase64 := Base64Encode(rootPassword)
|
|
|
|
k8sAdminPass := GenerateRandomString(12, true)
|
|
|
|
fmt.Println(rootPassword)
|
|
fmt.Println(rootPasswordBase64)
|
|
fmt.Println()
|
|
fmt.Println(k8sAdminPass)
|
|
}
|