add arg for sharding, but not using it yet
This commit is contained in:
@@ -38,10 +38,15 @@ func GetVersions(ctx context.Context, src *dagger.Directory) (Deps, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
type RunTestOpts struct {
|
||||
Shard string
|
||||
GrafanaService *dagger.Service
|
||||
}
|
||||
|
||||
func RunTest(
|
||||
ctx context.Context,
|
||||
d *dagger.Client,
|
||||
grafanaService *dagger.Service,
|
||||
opts RunTestOpts,
|
||||
) (*dagger.Container, error) {
|
||||
|
||||
grafanaDir := "." // TODO: arg
|
||||
@@ -97,7 +102,7 @@ func RunTest(
|
||||
WithExec([]string{"yarn", "e2e:plugin:build"}).
|
||||
WithEnvVariable("HOST", grafanaHost).
|
||||
WithEnvVariable("PORT", fmt.Sprint(grafanaPort)).
|
||||
WithServiceBinding(grafanaHost, grafanaService).
|
||||
WithServiceBinding(grafanaHost, opts.GrafanaService).
|
||||
WithEnvVariable("PLAYWRIGHT_HTML_OPEN", "never").
|
||||
WithExec([]string{"yarn", "e2e:playwright"}, dagger.ContainerWithExecOpts{
|
||||
Expect: dagger.ReturnTypeAny,
|
||||
|
||||
@@ -52,6 +52,10 @@ func NewApp() *cli.Command {
|
||||
Validator: mustBeFile("license", true),
|
||||
TakesFile: true,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "shard",
|
||||
Usage: "Test shard to run. See Playwright docs",
|
||||
},
|
||||
// &cli.StringFlag{
|
||||
// Name: "config",
|
||||
// Usage: "Path to the pa11y config file to use",
|
||||
@@ -78,6 +82,7 @@ func run(ctx context.Context, cmd *cli.Command) error {
|
||||
grafanaDir := cmd.String("grafana-dir")
|
||||
targzPath := cmd.String("package")
|
||||
licensePath := cmd.String("license")
|
||||
pwShard := cmd.String("shard")
|
||||
// pa11yConfigPath := cmd.String("config")
|
||||
// pa11yResultsPath := cmd.String("results")
|
||||
// noThresholdFail := cmd.Bool("no-threshold-fail")
|
||||
@@ -116,7 +121,12 @@ func run(ctx context.Context, cmd *cli.Command) error {
|
||||
return fmt.Errorf("failed to create Grafana service: %w", err)
|
||||
}
|
||||
|
||||
c, runErr := RunTest(ctx, d, svc)
|
||||
runOpts := RunTestOpts{
|
||||
GrafanaService: svc,
|
||||
Shard: pwShard,
|
||||
}
|
||||
|
||||
c, runErr := RunTest(ctx, d, runOpts)
|
||||
if runErr != nil {
|
||||
return fmt.Errorf("failed to run e2e test suite: %w", runErr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user