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

feat: update test using definition file #638

Merged
merged 2 commits into from
Jun 2, 2022
Merged

Conversation

mathnogueira
Copy link
Member

@mathnogueira mathnogueira commented Jun 2, 2022

This PR makes the CLI update the test in case the id field is present in it.

Questions

  • What should happen if the id doesn't exist in the server? Should the CLI fail or should we ignore it and create a new test?

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

@mathnogueira mathnogueira marked this pull request as ready for review June 2, 2022 16:25
@kdhamric
Copy link
Collaborator

kdhamric commented Jun 2, 2022

On "What should happen if the id doesn't exist in the server? Should the CLI fail or should we ignore it and create a new test?"

Can the system create the test with the given id (ie specify the id rather than let the system autodefine it)? If it can, I would create the test using the specified id.

@mathnogueira
Copy link
Member Author

mathnogueira commented Jun 2, 2022

On "What should happen if the id doesn't exist in the server? Should the CLI fail or should we ignore it and create a new test?"

Can the system create the test with the given id (ie specify the id rather than let the system autodefine it)? If it can, I would create the test using the specified id.

Right now our backend doesn't allow this option. Everytime you call CreateTest, it assigns a new ìd to it.

@schoren
Copy link
Collaborator

schoren commented Jun 2, 2022

Yes, the backend doesn't allow incoming IDs. Also, given that this is an update command, trying to update a non existing thing should be considered an error IMO

@mathnogueira
Copy link
Member Author

mathnogueira commented Jun 2, 2022

Yes, the backend doesn't allow incoming IDs. Also, given that this is an update command, trying to update a non existing thing should be considered an error IMO

Just a correction there: Updating and Creating a test in the CLI are done by the same command. The decision of creating or updating the test depends on the value of the id on the test definition. If it is present, it becomes an update test request, otherwise, it would be a create test request.

I don't think the id should matter so much that the user might want to choose it. If the id is important, we should think about a human-readable id alias (kind of what confluence does with its pages). Now about the question, I think that behavior could be configurable. A suggestion would be:

  1. Default behavior is that it creates a new test with a different id if the id specified in the test file doesn't exist (and it would print a warning on the output)
  2. If the option --strict is provided, the behavior would change and it would fail

It could be the other way around as well: fail by default and allow the user to override that behavior

@kdhamric
Copy link
Collaborator

kdhamric commented Jun 2, 2022

We need a good bit more planning and consensus building around the CLI. Lets keep things as basic as possible, doing a bare MVP. We will shift into planning mode next week.

@mathnogueira
Copy link
Member Author

Sure. I'll keep it as it is then. The CLI will fail if an invalid id is provided.

Copy link
Collaborator

@schoren schoren left a comment

Choose a reason for hiding this comment

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

LGTM!

@mathnogueira mathnogueira merged commit 3f70820 into main Jun 2, 2022
@mathnogueira mathnogueira deleted the feat/cli-update-test branch June 2, 2022 20:42
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.

3 participants