Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXCDT-386: Expand apps test cases and move to own test file #652

Merged
merged 5 commits into from
Mar 3, 2023

Conversation

sergiught
Copy link
Contributor

@sergiught sergiught commented Feb 28, 2023

🔧 Changes

Expands the apps test cases and moves them to their own test file. While adding more test cases a few bugs surfaced and were fixes as well, see comments below.

📚 References

🔬 Testing

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)


settingsURL := fmt.Sprintf("%s%s", manageTenantURL, path)

if cli.noInput {
Copy link
Contributor Author

@sergiught sergiught Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue with the no input flag surfaced through the test and it is now fixed.

inherit-env: true

tests:
01 - it successfully lists all apps:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately all tests run in alphabetical order, so we're trying to enforce an order like this.

@@ -92,6 +92,10 @@ build: ## Build the cli binary for the native platform
${call print, "Building the cli binary"}
go build -v -ldflags "$(GO_LINKER_FLAGS)" -o "${BUILD_DIR}/auth0" cmd/auth0/main.go

build-with-cover: ## Build the cli binary for the native platform with coverage support.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These will be used later when adding the coverage badge on the README.

@@ -272,6 +273,7 @@ func RunLoginAsMachine(ctx context.Context, inputs LoginInputs, cli *cli, cmd *c
}

t := Tenant{
Name: strings.Split(inputs.Domain, ".")[0],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a bug where all the dashboard URLs were empty when using client credentials because the name of the tenant was missing.

@sergiught sergiught self-assigned this Mar 1, 2023
@sergiught sergiught marked this pull request as ready for review March 1, 2023 13:08
@sergiught sergiught requested a review from a team as a code owner March 1, 2023 13:08
@sergiught sergiught changed the title Expand apps test cases and move to own test file DXCDT-386: Expand apps test cases and move to own test file Mar 1, 2023
json:
web_origins: "[https://example.com]"

021 - given a test app:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a test case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need some way to assert that the app used in the below steps is created, otherwise they will all fail. Not the perfect solution unfortunately, as we're quite limited by this commander test runner. Long term I'd love for us to get rid of this way of testing and take https://github.com/cli/cli/blob/trunk/pkg/cmd/issue/list/list_test.go as an example instead.

Copy link
Contributor

@Widcket Widcket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that by using sequential numbering, adding e.g. a new 'create' test for a future new flag may require re-numbering all the tests below, unless new tests are just appended at the end (and thus placed outside their CRUD 'group').

@sergiught
Copy link
Contributor Author

Yep that's something we are aware of @Widcket 👍🏻 and I was planning on adding a make command that uses yq to regenerate the numbering automatically when new tests are introduced. I decided however to defer this for later due to time constraints.

@sergiught sergiught requested a review from willvedd March 1, 2023 17:55
@sergiught sergiught merged commit 1f062c8 into main Mar 3, 2023
@sergiught sergiught deleted the DXCDT-386-test-coverage branch March 3, 2023 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants