fix(scaletest): correctly validate configs using `SessionToken` (#7111)

This commit is contained in:
Colin Adler 2023-04-12 17:36:05 -05:00 committed by GitHub
parent f517724caa
commit 17f692a89a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -26,11 +26,13 @@ func (c UserConfig) Validate() error {
if c.OrganizationID == uuid.Nil {
return xerrors.New("organization_id must not be a nil UUID")
}
if c.Username == "" {
return xerrors.New("username must be set")
}
if c.Email == "" {
return xerrors.New("email must be set")
if c.SessionToken == "" {
if c.Username == "" {
return xerrors.New("username must be set")
}
if c.Email == "" {
return xerrors.New("email must be set")
}
}
return nil

View File

@ -72,7 +72,7 @@ func (r *Runner) Run(ctx context.Context, id string, logs io.Writer) error {
_, _ = fmt.Fprintln(logs, "Creating user:")
user, err := r.client.CreateUser(ctx, codersdk.CreateUserRequest{
user, err = r.client.CreateUser(ctx, codersdk.CreateUserRequest{
OrganizationID: r.cfg.User.OrganizationID,
Username: r.cfg.User.Username,
Email: r.cfg.User.Email,