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

ci: add backwards compatibility tests #23

Merged
merged 9 commits into from
Aug 5, 2024
Merged

ci: add backwards compatibility tests #23

merged 9 commits into from
Aug 5, 2024

Conversation

dhth
Copy link
Owner

@dhth dhth commented Aug 3, 2024

No description provided.

cmd/root.go Outdated
Comment on lines 62 to 65
_ = rootCmd.Execute()
err = rootCmd.Execute()
if err != nil {
os.Exit(1)
}

Choose a reason for hiding this comment

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

I have a problem with this code.

There should be no os.Exit in code outside main.go.

I would like to suggest you to update the signature of execute to return an error. And to have this if err != nil os.Exit(1) in main.go

It's not related to this PR, the problem was already there. But I'm discovering it now, so I report it now

Comment on lines 31 to 39
with:
ref: main
- name: build main
run: |
go build -o omm_main
cp omm_main /var/tmp
- name: Run last version
run: |
/var/tmp/omm_main --db-path=omm-test.db 'test: a task from main'

Choose a reason for hiding this comment

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

Cannot this be covered by a test?

Could what I suggested to fix some issues that led you doing this here?

Copy link
Owner Author

Choose a reason for hiding this comment

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

This is for ensuring any changes to the data persistence side of things (database migrations, handling of errors) do not mess anything up for already running instances of omm. Specifically, for ensuring that a change doesn't break for folks who already have a omm.db file out there.

I guess this may be tested via code tests (would need simulating real world conditions in tests); running the real thing in CI seemed like a good first step.

Copy link
Owner Author

@dhth dhth Aug 3, 2024

Choose a reason for hiding this comment

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

Eg. for cases like this one.

Comment on lines 35 to 37
- name: Run last version
run: |
/var/tmp/omm_prev --db-path=omm-test.db 'test: a task from previous commit'

Choose a reason for hiding this comment

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

Are you sure you will be able to merge/release if a bug occur ?

Maybe because a library changed, or you bumped go version.

I mean if code is KO, this will fail, so you won't be able to merge?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I didn't fully understand. Could you describe the scenario a bit more?

Choose a reason for hiding this comment

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

You are adding something to the workflow.

So to something that may prevent you to do errors

Now imagine you merged something, and because of something outside your code. It could be the go version, an external package, a tool… your tests no longer pass, even if they did before.

So now your tests are failing.
So you provide a fix
You push
The workflow is run
The code that check if it's a regression, the code you added with the PR about the workflow, will fail because tests are failing.

So now the workflow is failing, won't it prevent you to merge the fix ?

@dhth dhth marked this pull request as ready for review August 3, 2024 22:33
@dhth dhth merged commit 047a5fd into main Aug 5, 2024
3 checks passed
@dhth dhth deleted the add-back-compat-tests branch August 5, 2024 17:35
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