Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions acceptance/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ inputs:
codegen_path:
description: 'Relative path to the .codegen.json file to use for configuring the acceptance tests'
required: false # by default the first .codegen.json found in the project is used
n:
description: 'Number of parallel pytest workers (pytest-xdist -n).'
required: false
default: '10'
Comment thread
alexott marked this conversation as resolved.
outputs:
sample:
description: 'Sample output'
Expand Down
2 changes: 1 addition & 1 deletion acceptance/ecosystem/pytest_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def pytest_runtest_logreport(self, report: pytest.TestReport):

if __name__ == '__main__':
sys.exit(pytest.main([
'-n', '10',
'-n', (os.environ.get('PYTEST_N') or '').strip() or '10',
"--log-disable", "urllib3.connectionpool",
"--log-format", "%(asctime)s %(levelname)s [%(name)s] %(message)s",
"--log-date-format", "%H:%M",
Expand Down
3 changes: 3 additions & 0 deletions acceptance/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func (a *acceptance) trigger(ctx context.Context) (*notify.Notification, error)
// set codegen path file used for configuring the acceptance tests
codegenPath := a.Action.GetInput("codegen_path")
ctx = env.Set(ctx, "codegen_path", codegenPath)
if n := a.Action.GetInput("n"); n != "" {
ctx = env.Set(ctx, "PYTEST_N", n)
}
redact := loaded.Redaction()
report, err := a.runWithTimeout(ctx, redact, directory)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions acceptance/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func TestXxx(t *testing.T) {
t.Skip()
ctx := context.Background()
ctx = env.Set(ctx, "INPUT_DIRECTORY", "../go-libs")
ctx = env.Set(ctx, "INPUT_N", "4") // verify PYTEST_N=4 in pytest output
err := run(ctx)
assert.NoError(t, err)
}
2 changes: 1 addition & 1 deletion acceptance/testenv/githubOidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (cpf *credentialsProviderFunc) SetHeaders(r *http.Request) error {

// Configure implements credentials provider for Databricks SDK
func (c *ghOidcCreds) Configure(ctx context.Context, cfg *config.Config) (credentials.CredentialsProvider, error) {
ts, err := c.oidcTokenSource(ctx, cfg.Environment().AzureApplicationID)
ts, err := c.oidcTokenSource(ctx, environment.GetEnvironmentForHostname(cfg.CanonicalHostName()).AzureApplicationID)
if err != nil {
return nil, fmt.Errorf("oidc: %w", err)
}
Expand Down
7 changes: 4 additions & 3 deletions acceptance/testenv/loaded.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (l *loadedEnv) Cloud() environment.Cloud {
if err != nil {
return environment.CloudAWS
}
return cfg.Environment().Cloud
return environment.GetEnvironmentForHostname(cfg.CanonicalHostName()).Cloud
}

func (l *loadedEnv) Start(ctx context.Context) (context.Context, func(), error) {
Expand All @@ -80,7 +80,8 @@ func (l *loadedEnv) Start(ctx context.Context) (context.Context, func(), error)
return nil, nil, fmt.Errorf("config: %w", err)
}
srv := l.metadataServer(cfg)
ctx = env.Set(ctx, "CLOUD_ENV", strings.ToLower(string(cfg.Environment().Cloud)))
cloud := environment.GetEnvironmentForHostname(cfg.CanonicalHostName()).Cloud
ctx = env.Set(ctx, "CLOUD_ENV", strings.ToLower(string(cloud)))
ctx = env.Set(ctx, "DATABRICKS_METADATA_SERVICE_URL", fmt.Sprintf("%s/%s", srv.URL, l.mpath))
ctx = env.Set(ctx, "DATABRICKS_AUTH_TYPE", "metadata-service")
isAuth := map[string]bool{}
Expand All @@ -104,7 +105,7 @@ func (l *loadedEnv) Start(ctx context.Context) (context.Context, func(), error)
}

func (l *loadedEnv) metadataServer(seed *config.Config) *httptest.Server {
accountHost := seed.Environment().DeploymentURL("accounts")
accountHost := environment.GetEnvironmentForHostname(seed.CanonicalHostName()).DeploymentURL("accounts")
configurations := map[string]*config.Config{
seed.CanonicalHostName(): seed,
accountHost: {
Expand Down