func ValidateConfig(config *MysqlIntegrationConfig) error { err := services.ValidateConfig(&config.Config) if err != nil { return err } if config.ServiceName == "" { return fmt.Errorf("Field 'service_name' must not be empty") } if config.Plans == nil { return fmt.Errorf("Field 'plans' must not be nil") } if len(config.Plans) == 0 { return fmt.Errorf("Field 'plans' must not be empty") } for index, plan := range config.Plans { if plan.Name == "" { return fmt.Errorf("Field 'plans[%d].name' must not be empty", index) } if plan.MaxStorageMb == 0 { return fmt.Errorf("Field 'plans[%d].max_storage_mb' must not be empty", index) } if plan.MaxUserConnections == 0 { return fmt.Errorf("Field 'plans[%d].max_user_connections' must not be empty", index) } } if config.BrokerHost == "" { return fmt.Errorf("Field 'broker_host' must not be empty") } if len(config.Proxy.DashboardUrls) == 0 { return fmt.Errorf("Field 'proxy.dashboardUrls' must not be empty") } for index, url := range config.Proxy.DashboardUrls { if url == "" { return fmt.Errorf("Field 'proxy.dashboard_urls[%d]' must not be empty", index) } } if config.Proxy.APIUsername == "" { return fmt.Errorf("Field 'proxy.api_username' must not be empty") } if config.Proxy.APIPassword == "" { return fmt.Errorf("Field 'proxy.api_password' must not be empty") } return nil }
func TestService(t *testing.T) { if err := services.ValidateConfig(&config.Config); err != nil { fatal(err) } ctx = services.NewContext(config.Config, "rabbitmq-smoke-tests") RegisterFailHandler(Fail) RunSpecs(t, "RabbitMQ Smoke Tests") }
func ValidateConfig(config *RdpgIntegrationConfig) error { err := services.ValidateConfig(&config.Config) if err != nil { return err } if config.ServiceName == "" { return fmt.Errorf("Field 'service_name' must not be empty") } if config.Plans == nil { return fmt.Errorf("Field 'plans' must not be nil") } if len(config.Plans) == 0 { return fmt.Errorf("Field 'plans' must not be empty") } for index, plan := range config.Plans { if plan.Name == "" { return fmt.Errorf("Field 'plans[%d].name' must not be empty", index) } if plan.MaxStorageMb == 0 { return fmt.Errorf("Field 'plans[%d].max_storage_mb' must not be empty", index) } if plan.MaxUserConnections == 0 { return fmt.Errorf("Field 'plans[%d].max_user_connections' must not be empty", index) } } if config.BrokerUrlBase == "" { return fmt.Errorf("Field 'broker_url_base' must not be empty") } if config.BrokerAdminUser == "" { return fmt.Errorf("Field 'broker_admin_user' must not be empty") } if config.BrokerAdminPassword == "" { return fmt.Errorf("Field 'broker_admin_password' must not be empty") } // emptyProxy := Proxy{} // if config.Proxy == emptyProxy { // return fmt.Errorf("Field 'proxy' must not be empty") // } // if config.Proxy.ExternalHost == "" { // return fmt.Errorf("Field 'proxy.external_host' must not be empty") // } // if config.Proxy.APIUsername == "" { // return fmt.Errorf("Field 'proxy.api_username' must not be empty") // } // if config.Proxy.APIPassword == "" { // return fmt.Errorf("Field 'proxy.api_password' must not be empty") // } return nil }