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

Implemented skip unsafe flag for our integration tests #464

Merged
merged 9 commits into from
Apr 19, 2023

Conversation

miladz68
Copy link
Contributor

@miladz68 miladz68 commented Apr 11, 2023

This change is Reviewable

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 10 files reviewed, 1 unresolved discussion (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/init.go line 56 at r1 (raw file):

	flag.StringVar(&logFormat, "log-format", string(logger.ToolDefaultConfig.Format), "Format of logs produced by tests")
	flag.StringVar(&chainID, "chain-id", string(constant.ChainIDDev), "Which chain-id to use (coreum-devnet-1, coreum-testnet-1,...)")
	flag.BoolVar(&skipUnsafe, "skip-unsafe", true, "skip unsafe tests for example ones related to governance")

But how do we check that the flag is required?

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewed 10 of 10 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/init.go line 56 at r1 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

But how do we check that the flag is required?

we don't check that it is required, but we default it true and rely on crust to ensure that it always false if you use crust (in CI). the default flag package does not have a method to ensure a flag is provided and we need to process cmd args manually to make sure it is provided which is a little ugly.

dzmitryhil
dzmitryhil previously approved these changes Apr 12, 2023
Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase, @wojtek-coreum, and @ysv)

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 10 of 10 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @silverspase, and @wojtek-coreum)

a discussion (no related file):
Have you 100% checked all tests ?



integration-tests/chain.go line 171 at r1 (raw file):

// SetSkipUnsafe sets skip unsafe flag.
func (c *Chain) SetSkipUnsafe(skipUnsafe bool) {

I disagree that it should be a method & field of chain
I see a better place for it: put this field into global variable cfg

and we can just make it function not method

func SkipUnsafe(t *testing.T) {
  if cfg.skipUnsafe {
   t.SkipNow()
  }
}

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 8 of 10 files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @silverspase, @wojtek-coreum, and @ysv)

a discussion (no related file):

Previously, ysv (Yaroslav Savchuk) wrote…

Have you 100% checked all tests ?

I have.



integration-tests/chain.go line 171 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

I disagree that it should be a method & field of chain
I see a better place for it: put this field into global variable cfg

and we can just make it function not method

func SkipUnsafe(t *testing.T) {
  if cfg.skipUnsafe {
   t.SkipNow()
  }
}

Done.

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewable status: 8 of 10 files reviewed, 3 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @ysv)

a discussion (no related file):
I would say that it should be done the other way. Unsafe tests should be skipped by default and executed only if --unsafe flag is provided


@ysv ysv requested a review from wojtek-coreum April 13, 2023 10:09
Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @silverspase, and @wojtek-coreum)

a discussion (no related file):

Previously, wojtek-coreum (Wojtek) wrote…

I would say that it should be done the other way. Unsafe tests should be skipped by default and executed only if --unsafe flag is provided

This has already been discussed
I had opinion similar to yours and Milad & Dzmitry suggested current behaviour

Don't have strong opinion here. Could be discussed again if needed



integration-tests/chain.go line 172 at r2 (raw file):

// unsafe tests can only be run against a locally running chain since they modify parameters
// of the chain.
func (c Chain) SkipUnsafe(t *testing.T) {

doesn't make sense for me to make it a method of chain
just usual func is ok

side benefit is that you can call it right in the beginning of func then before initialization of chain variable

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 9 of 10 files reviewed, 2 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)


integration-tests/chain.go line 172 at r2 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

doesn't make sense for me to make it a method of chain
just usual func is ok

side benefit is that you can call it right in the beginning of func then before initialization of chain variable

Done.

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 10 files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @silverspase, and @ysv)

a discussion (no related file):

Previously, ysv (Yaroslav Savchuk) wrote…

This has already been discussed
I had opinion similar to yours and Milad & Dzmitry suggested current behaviour

Don't have strong opinion here. Could be discussed again if needed

I think in 99% of cases boolean flag is used to set sth to true, not to false.


dzmitryhil
dzmitryhil previously approved these changes Apr 14, 2023
Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r2, 9 of 9 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @silverspase and @ysv)

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 9 of 9 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @silverspase)

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 10 of 11 files reviewed, 1 unresolved discussion (waiting on @silverspase and @wojtek-coreum)

a discussion (no related file):

Previously, wojtek-coreum (Wojtek) wrote…

I think in 99% of cases boolean flag is used to set sth to true, not to false.

@ysv how about we call the flag run-unsafe and keep the default value to false ?


Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r2, 9 of 9 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @miladz68 and @silverspase)


.github/workflows/ci.yml line 19 at r5 (raw file):

          "build", 
          "integration tests coreum-modules", 
          # "integration tests coreum-upgrade", 

why is it needed?


integration-tests/chain.go line 175 at r5 (raw file):

// unsafe tests can only be run against a locally running chain since they modify parameters
// of the chain.
func SkipUnsafe(t *testing.T) {

chain.go is not the best file for this function

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @silverspase and @wojtek-coreum)


.github/workflows/ci.yml line 19 at r5 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

why is it needed?

upgrade test is considered an unsafe test and we skip it, it means the upgrade action never takes place and the test fails.


integration-tests/chain.go line 175 at r5 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

chain.go is not the best file for this function

none of the other files are good as well tbh.

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @silverspase and @wojtek-coreum)


.github/workflows/ci.yml line 19 at r5 (raw file):

Previously, miladz68 (milad) wrote…

upgrade test is considered an unsafe test and we skip it, it means the upgrade action never takes place and the test fails.

we can enable it back after crust is integrated to run unsafe tests.

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68 and @silverspase)


integration-tests/chain.go line 175 at r5 (raw file):

Previously, miladz68 (milad) wrote…

none of the other files are good as well tbh.

You are right, let's create a new one like testing.go

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @silverspase and @wojtek-coreum)


integration-tests/chain.go line 175 at r5 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

You are right, let's create a new one like testing.go

but that is not a very informative name, how about helpers.go ?

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68 and @silverspase)


integration-tests/chain.go line 175 at r5 (raw file):

Previously, miladz68 (milad) wrote…

but that is not a very informative name, how about helpers.go ?

entropies of both names are equal :D. Both are ok for me.

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @silverspase, and @wojtek-coreum)

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @silverspase)

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @silverspase and @wojtek-coreum)


integration-tests/chain.go line 175 at r5 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

entropies of both names are equal :D. Both are ok for me.

Done.

@ysv ysv requested a review from wojtek-coreum April 18, 2023 16:54
ysv
ysv previously approved these changes Apr 18, 2023
Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @silverspase and @wojtek-coreum)

a discussion (no related file):
run-unsafe makes a bit more sense for me so agree with Wojtek a bit more

I think in 99% of cases boolean flag is used to set sth to true, not to false.
Because of this mostly

Still not critical and both options are acceptable for me


Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase)

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase)

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase)

@miladz68 miladz68 merged commit 0328666 into master Apr 19, 2023
@miladz68 miladz68 deleted the milad/skip-unsafe-tests branch April 19, 2023 12:15
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.

4 participants