|
|
@@ -185,14 +185,6 @@ func TestIntegrationController_pullWatchers(t *testing.T) {
|
|
|
},
|
|
|
},
|
|
|
expectedStatuses: []*Status{
|
|
|
- {
|
|
|
- Source: HelmSource,
|
|
|
- Key: validAthenaConf.Key(),
|
|
|
- Active: false, // this value changed
|
|
|
- Valid: true,
|
|
|
- ConfigType: AthenaConfigType,
|
|
|
- Config: validAthenaConf,
|
|
|
- },
|
|
|
{
|
|
|
Source: HelmSource,
|
|
|
Key: validBigQueryConf.Key(),
|
|
|
@@ -330,14 +322,6 @@ func TestIntegrationController_pullWatchers(t *testing.T) {
|
|
|
},
|
|
|
},
|
|
|
expectedStatuses: []*Status{
|
|
|
- {
|
|
|
- Source: ConfigFileSource,
|
|
|
- Key: validAthenaConf.Key(),
|
|
|
- Active: false, // this value changed
|
|
|
- Valid: true,
|
|
|
- ConfigType: AthenaConfigType,
|
|
|
- Config: validAthenaConf,
|
|
|
- },
|
|
|
{
|
|
|
Source: ConfigFileSource,
|
|
|
Key: validBigQueryConf.Key(),
|
|
|
@@ -477,21 +461,29 @@ func TestIntegrationController_pullWatchers(t *testing.T) {
|
|
|
expectedStatuses: []*Status{
|
|
|
{
|
|
|
Source: MultiCloudSource,
|
|
|
- Key: validAthenaConf.Key(),
|
|
|
+ Key: validBigQueryConf.Key(),
|
|
|
Active: true,
|
|
|
Valid: true,
|
|
|
- ConfigType: AthenaConfigType,
|
|
|
- Config: validAthenaConf,
|
|
|
+ ConfigType: BigQueryConfigType,
|
|
|
+ Config: validBigQueryConf,
|
|
|
},
|
|
|
+ },
|
|
|
+ },
|
|
|
+ "Multi Cloud Delete All": {
|
|
|
+ initialStatuses: []*Status{
|
|
|
{
|
|
|
Source: MultiCloudSource,
|
|
|
- Key: validBigQueryConf.Key(),
|
|
|
+ Key: validAthenaConf.Key(),
|
|
|
Active: true,
|
|
|
Valid: true,
|
|
|
- ConfigType: BigQueryConfigType,
|
|
|
- Config: validBigQueryConf,
|
|
|
+ ConfigType: AthenaConfigType,
|
|
|
+ Config: validAthenaConf,
|
|
|
},
|
|
|
},
|
|
|
+ configWatchers: map[ConfigSource]cloudconfig.KeyedConfigWatcher{
|
|
|
+ MultiCloudSource: &MockKeyedConfigWatcher{},
|
|
|
+ },
|
|
|
+ expectedStatuses: []*Status{},
|
|
|
},
|
|
|
// Watch Interaction
|
|
|
"New Helm, Existing Config File": {
|
|
|
@@ -722,14 +714,6 @@ func TestIntegrationController_pullWatchers(t *testing.T) {
|
|
|
},
|
|
|
"Update Config File, Existing Helm": {
|
|
|
initialStatuses: []*Status{
|
|
|
- {
|
|
|
- Source: ConfigFileSource,
|
|
|
- Key: validAthenaConf.Key(),
|
|
|
- Active: false,
|
|
|
- Valid: true,
|
|
|
- ConfigType: AthenaConfigType,
|
|
|
- Config: validAthenaConf,
|
|
|
- },
|
|
|
{
|
|
|
Source: HelmSource,
|
|
|
Key: validBigQueryConf.Key(),
|
|
|
@@ -758,14 +742,6 @@ func TestIntegrationController_pullWatchers(t *testing.T) {
|
|
|
ConfigType: AthenaConfigType,
|
|
|
Config: validAthenaConfModifiedProperty,
|
|
|
},
|
|
|
- {
|
|
|
- Source: HelmSource,
|
|
|
- Key: validBigQueryConf.Key(),
|
|
|
- Active: false,
|
|
|
- Valid: true,
|
|
|
- ConfigType: BigQueryConfigType,
|
|
|
- Config: validBigQueryConf,
|
|
|
- },
|
|
|
},
|
|
|
},
|
|
|
"New Config File Invalid, Existing Helm": {
|
|
|
@@ -1037,13 +1013,6 @@ func TestIntegrationController_EnableConfig(t *testing.T) {
|
|
|
inputSource: ConfigControllerSource.String(),
|
|
|
expectErr: true,
|
|
|
},
|
|
|
- "invalid source": {
|
|
|
- initial: []*Status{},
|
|
|
- expected: []*Status{},
|
|
|
- inputKey: validAthenaConf.Key(),
|
|
|
- inputSource: MultiCloudSource.String(),
|
|
|
- expectErr: true,
|
|
|
- },
|
|
|
"config is already enabled": {
|
|
|
initial: []*Status{
|
|
|
makeStatus(validAthenaConf, true, ConfigControllerSource),
|
|
|
@@ -1055,6 +1024,17 @@ func TestIntegrationController_EnableConfig(t *testing.T) {
|
|
|
inputSource: ConfigControllerSource.String(),
|
|
|
expectErr: true,
|
|
|
},
|
|
|
+ "alternate source": {
|
|
|
+ initial: []*Status{
|
|
|
+ makeStatus(validAthenaConf, false, MultiCloudSource),
|
|
|
+ },
|
|
|
+ expected: []*Status{
|
|
|
+ makeStatus(validAthenaConf, true, MultiCloudSource),
|
|
|
+ },
|
|
|
+ inputKey: validAthenaConf.Key(),
|
|
|
+ inputSource: MultiCloudSource.String(),
|
|
|
+ expectErr: false,
|
|
|
+ },
|
|
|
"enabled disabled single config": {
|
|
|
initial: []*Status{
|
|
|
makeStatus(validAthenaConf, false, ConfigControllerSource),
|
|
|
@@ -1146,13 +1126,7 @@ func TestIntegrationController_DisableConfig(t *testing.T) {
|
|
|
inputSource: ConfigControllerSource.String(),
|
|
|
expectErr: true,
|
|
|
},
|
|
|
- "invalid source": {
|
|
|
- initial: []*Status{},
|
|
|
- expected: []*Status{},
|
|
|
- inputKey: validAthenaConf.Key(),
|
|
|
- inputSource: MultiCloudSource.String(),
|
|
|
- expectErr: true,
|
|
|
- },
|
|
|
+
|
|
|
"config is already disabled": {
|
|
|
initial: []*Status{
|
|
|
makeStatus(validAthenaConf, false, ConfigControllerSource),
|
|
|
@@ -1177,6 +1151,17 @@ func TestIntegrationController_DisableConfig(t *testing.T) {
|
|
|
inputSource: ConfigControllerSource.String(),
|
|
|
expectErr: false,
|
|
|
},
|
|
|
+ "alternate source": {
|
|
|
+ initial: []*Status{
|
|
|
+ makeStatus(validAthenaConf, true, MultiCloudSource),
|
|
|
+ },
|
|
|
+ expected: []*Status{
|
|
|
+ makeStatus(validAthenaConf, false, MultiCloudSource),
|
|
|
+ },
|
|
|
+ inputKey: validAthenaConf.Key(),
|
|
|
+ inputSource: MultiCloudSource.String(),
|
|
|
+ expectErr: false,
|
|
|
+ },
|
|
|
"disable config, matching config from separate source": {
|
|
|
initial: []*Status{
|
|
|
makeStatus(validAthenaConf, true, ConfigControllerSource),
|
|
|
@@ -1369,7 +1354,7 @@ func buildStatuses(statusList []*Status) (Statuses, error) {
|
|
|
|
|
|
func checkStatuses(actual, expected Statuses) error {
|
|
|
if len(actual.List()) != len(expected.List()) {
|
|
|
- return fmt.Errorf("integration statueses did not have the correct length actaul: %d, expected: %d", len(actual), len(expected))
|
|
|
+ return fmt.Errorf("integration statueses did not have the correct length actaul: %d, expected: %d", len(actual.List()), len(expected.List()))
|
|
|
}
|
|
|
|
|
|
for _, actualStatus := range actual.List() {
|