databricks-cli/cmd/test/test.go

38 lines
993 B
Go
Raw Normal View History

2022-05-14 17:54:35 +00:00
package test
2022-05-13 13:30:22 +00:00
import (
"log"
2022-05-14 17:54:35 +00:00
"github.com/databricks/bricks/cmd/root"
2022-05-13 13:30:22 +00:00
"github.com/databricks/bricks/project"
"github.com/spf13/cobra"
)
// testCmd represents the test command
var testCmd = &cobra.Command{
Use: "test",
Short: "run tests for the project",
Long: `This is longer description of the command`,
Run: func(cmd *cobra.Command, args []string) {
results := project.RunPythonOnDev(cmd.Context(), `return 1`)
2022-05-13 13:30:22 +00:00
if results.Failed() {
log.Fatal(results.Error())
}
log.Printf("Success: %s", results.Text())
},
}
func init() {
2022-05-14 17:54:35 +00:00
root.RootCmd.AddCommand(testCmd)
2022-05-13 13:30:22 +00:00
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// testCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// testCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}