diff --git a/cmd/ltctl/report.go b/cmd/ltctl/report.go index 0f7290990..7395c7f9b 100644 --- a/cmd/ltctl/report.go +++ b/cmd/ltctl/report.go @@ -76,7 +76,7 @@ func RunGenerateReportCmdF(cmd *cobra.Command, args []string) error { } if promURL == "" { - fmt.Printf("Flag --prometheus-url is not set. Defaulting to the deployment's Prometheus server...") + fmt.Println("Flag --prometheus-url is not set. Defaulting to the deployment's Prometheus server...") config, err := getConfig(cmd) if err != nil { return err @@ -90,6 +90,11 @@ func RunGenerateReportCmdF(cmd *cobra.Command, args []string) error { if err != nil { return fmt.Errorf("could not parse output: %w", err) } + + if !output.HasMetrics() { + return fmt.Errorf("no active deployment found, use the `--prometheus-url` flag if you have a local or manually deployed Prometheus server running") + } + promURL = "http://" + output.MetricsServer.PublicIP + ":9090" } diff --git a/deployment/config.go b/deployment/config.go index 44c20c19a..3995ab8be 100644 --- a/deployment/config.go +++ b/deployment/config.go @@ -93,7 +93,7 @@ type Config struct { Report report.Config // Directory under which the .terraform directory and state files are managed. // It will be created if it does not exist - TerraformStateDir string `default:"/var/lib/mattermost-load-test-ng" validate:"notempty"` + TerraformStateDir string `default:"./ltstate" validate:"notempty"` // URI of an S3 bucket whose contents are copied to the bucket created in the deployment S3BucketDumpURI string `default:"" validate:"s3uri"` // An optional URI to a MM server database dump file @@ -246,7 +246,7 @@ type TerraformDBSettings struct { // and provisioned. type ExternalDBSettings struct { // Mattermost database driver - DriverName string `default:"" validate:"oneof:{mysql, postgres, cockroach}"` + DriverName string `default:"postgres" validate:"oneof:{mysql, postgres, cockroach}"` // DSN to connect to the database DataSource string `default:""` // DSN to connect to the database replicas diff --git a/deployment/config_test.go b/deployment/config_test.go index 432bfbc2f..e9989c970 100644 --- a/deployment/config_test.go +++ b/deployment/config_test.go @@ -238,6 +238,9 @@ func TestClusterSubnetIDs(t *testing.T) { require.NotNil(t, cfg.ClusterSubnetIDs.Redis) require.Len(t, cfg.ClusterSubnetIDs.Redis, 0) + + require.NotNil(t, cfg.TerraformStateDir) + require.Equal(t, "./ltstate", cfg.TerraformStateDir) }) t.Run("String() of default values", func(t *testing.T) {