mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-08 15:21:55 +00:00
Allow override of discovery URL via ConfigMap
Signed-off-by: Andrew Keesler <akeesler@vmware.com> - Seems like the next step is to allow override of the CA bundle; I didn't do that here for simplicity of the commit, but seems like it is the right thing to do in the future.
This commit is contained in:
@@ -7,7 +7,6 @@ package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -52,8 +51,7 @@ O2D8LtWhMbrYy755Fgq4H9s3vCgfvHY1AQ==
|
||||
)
|
||||
|
||||
func TestClient(t *testing.T) {
|
||||
tmcClusterToken := os.Getenv("PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN")
|
||||
require.NotEmptyf(t, tmcClusterToken, "must specify PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN env var for integration tests")
|
||||
tmcClusterToken := library.Getenv(t, "PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN")
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
@@ -7,7 +7,6 @@ package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -20,11 +19,8 @@ import (
|
||||
)
|
||||
|
||||
func TestGetDeployment(t *testing.T) {
|
||||
namespaceName := os.Getenv("PLACEHOLDER_NAME_NAMESPACE")
|
||||
require.NotEmptyf(t, namespaceName, "must specify PLACEHOLDER_NAME_NAMESPACE env var for integration tests")
|
||||
|
||||
deploymentName := os.Getenv("PLACEHOLDER_NAME_DEPLOYMENT")
|
||||
require.NotEmptyf(t, deploymentName, "must specify PLACEHOLDER_NAME_DEPLOYMENT env var for integration tests")
|
||||
namespaceName := library.Getenv(t, "PLACEHOLDER_NAME_NAMESPACE")
|
||||
deploymentName := library.Getenv(t, "PLACEHOLDER_NAME_DEPLOYMENT")
|
||||
|
||||
client := library.NewClientset(t)
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ package integration
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -21,8 +20,8 @@ import (
|
||||
)
|
||||
|
||||
func TestSuccessfulLoginDiscoveryConfig(t *testing.T) {
|
||||
namespaceName := os.Getenv("PLACEHOLDER_NAME_NAMESPACE")
|
||||
require.NotEmptyf(t, namespaceName, "must specify PLACEHOLDER_NAME_NAMESPACE env var for integration tests")
|
||||
namespaceName := library.Getenv(t, "PLACEHOLDER_NAME_NAMESPACE")
|
||||
discoveryURL := library.Getenv(t, "PLACEHOLDER_NAME_DISCOVERY_URL")
|
||||
|
||||
client := library.NewPlaceholderNameClientset(t)
|
||||
|
||||
@@ -30,7 +29,7 @@ func TestSuccessfulLoginDiscoveryConfig(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
config := library.NewClientConfig(t)
|
||||
expectedLDCSpec := expectedLDCSpec(config)
|
||||
expectedLDCSpec := expectedLDCSpec(config, discoveryURL)
|
||||
configList, err := client.
|
||||
CrdsV1alpha1().
|
||||
LoginDiscoveryConfigs(namespaceName).
|
||||
@@ -41,8 +40,8 @@ func TestSuccessfulLoginDiscoveryConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestReconcilingLoginDiscoveryConfig(t *testing.T) {
|
||||
namespaceName := os.Getenv("PLACEHOLDER_NAME_NAMESPACE")
|
||||
require.NotEmptyf(t, namespaceName, "must specify PLACEHOLDER_NAME_NAMESPACE env var for integration tests")
|
||||
namespaceName := library.Getenv(t, "PLACEHOLDER_NAME_NAMESPACE")
|
||||
discoveryURL := library.Getenv(t, "PLACEHOLDER_NAME_DISCOVERY_URL")
|
||||
|
||||
client := library.NewPlaceholderNameClientset(t)
|
||||
|
||||
@@ -56,7 +55,7 @@ func TestReconcilingLoginDiscoveryConfig(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
config := library.NewClientConfig(t)
|
||||
expectedLDCSpec := expectedLDCSpec(config)
|
||||
expectedLDCSpec := expectedLDCSpec(config, discoveryURL)
|
||||
|
||||
var actualLDC *crdsplaceholderv1alpha1.LoginDiscoveryConfig
|
||||
for i := 0; i < 10; i++ {
|
||||
@@ -73,9 +72,9 @@ func TestReconcilingLoginDiscoveryConfig(t *testing.T) {
|
||||
require.Equal(t, expectedLDCSpec, &actualLDC.Spec)
|
||||
}
|
||||
|
||||
func expectedLDCSpec(config *rest.Config) *crdsplaceholderv1alpha1.LoginDiscoveryConfigSpec {
|
||||
func expectedLDCSpec(config *rest.Config, discoveryURL string) *crdsplaceholderv1alpha1.LoginDiscoveryConfigSpec {
|
||||
return &crdsplaceholderv1alpha1.LoginDiscoveryConfigSpec{
|
||||
Server: "https://kind-control-plane:6443", //config.Host, // TODO FIX THIS
|
||||
Server: discoveryURL,
|
||||
CertificateAuthorityData: base64.StdEncoding.EncodeToString(config.TLSClientConfig.CAData),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ package integration
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -37,8 +36,7 @@ func makeRequest(t *testing.T, spec v1alpha1.LoginRequestSpec) (*v1alpha1.LoginR
|
||||
}
|
||||
|
||||
func TestSuccessfulLoginRequest(t *testing.T) {
|
||||
tmcClusterToken := os.Getenv("PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN")
|
||||
require.NotEmptyf(t, tmcClusterToken, "must specify PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN env var for integration tests")
|
||||
tmcClusterToken := library.Getenv(t, "PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN")
|
||||
|
||||
response, err := makeRequest(t, v1alpha1.LoginRequestSpec{
|
||||
Type: v1alpha1.TokenLoginCredentialType,
|
||||
|
||||
Reference in New Issue
Block a user