Skip to content

Commit

Permalink
Merge pull request #558 from helixml/fix/helix-test-nits
Browse files Browse the repository at this point in the history
don't hardcode helix.yaml
  • Loading branch information
lukemarsden authored Oct 23, 2024
2 parents d30a1bc + 1be2833 commit 858f54a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/cmd/helix/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func NewTestCmd() *cobra.Command {
Short: "Run tests for Helix app",
Long: `This command runs tests defined in helix.yaml or a specified YAML file and evaluates the results.`,
RunE: func(cmd *cobra.Command, args []string) error {
return runTest(cmd, args, yamlFile)
return runTest(cmd, yamlFile)
},
}

Expand All @@ -342,7 +342,7 @@ func NewTestCmd() *cobra.Command {
return cmd
}

func runTest(cmd *cobra.Command, args []string, yamlFile string) error {
func runTest(cmd *cobra.Command, yamlFile string) error {
appConfig, helixYamlContent, err := readHelixYaml(yamlFile)
if err != nil {
return err
Expand All @@ -352,7 +352,7 @@ func runTest(cmd *cobra.Command, args []string, yamlFile string) error {
namespacedAppName := fmt.Sprintf("%s/%s", testID, appConfig.Name)

// Deploy the app with the namespaced name and appConfig
appID, err := deployApp(namespacedAppName, appConfig)
appID, err := deployApp(namespacedAppName, yamlFile)
if err != nil {
return fmt.Errorf("error deploying app: %v", err)
}
Expand Down Expand Up @@ -744,14 +744,14 @@ func truncate(s string, n int) string {
return s[:n] + "..."
}

func deployApp(namespacedAppName string, appConfig types.AppHelixConfig) (string, error) {
func deployApp(namespacedAppName string, yamlFile string) (string, error) {
apiClient, err := client.NewClientFromEnv()
if err != nil {
return "", fmt.Errorf("failed to create API client: %w", err)
}

// Use NewLocalApp to create the app from the original config
localApp, err := apps.NewLocalApp("helix.yaml")
localApp, err := apps.NewLocalApp(yamlFile)
if err != nil {
return "", fmt.Errorf("failed to create local app: %w", err)
}
Expand Down

0 comments on commit 858f54a

Please sign in to comment.