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

added init function to ibc integration tests package #574

Merged
merged 8 commits into from
Jul 24, 2023

Conversation

miladz68
Copy link
Contributor

@miladz68 miladz68 commented Jul 14, 2023

This change is Reviewable

@miladz68 miladz68 requested a review from a team as a code owner July 14, 2023 13:48
@miladz68 miladz68 requested review from dzmitryhil, vertex451, ysv and wojtek-coreum and removed request for a team July 14, 2023 13:48
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 2 files reviewed, 1 unresolved discussion (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)


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

func parseIBCFlags() {
	flagSet := flag.NewFlagSet("ibc", flag.ExitOnError)

What is the purpose of that flag?

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: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @silverspase, @wojtek-coreum, and @ysv)


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

Previously, dzmitryhil (Dzmitry Hil) wrote…

What is the purpose of that flag?

to parse ibc specific flags

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: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @silverspase, @wojtek-coreum, and @ysv)


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

Previously, miladz68 (milad) wrote…

to parse ibc specific flags

moved them back to integrationtest package, since they errored out here.

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 2 files reviewed, 1 unresolved discussion (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)


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

Previously, miladz68 (milad) wrote…

moved them back to integrationtest package, since they errored out here.

Didn't get last comment, in what case they errors out?

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 2 of 2 files at r2, 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/ibc/init.go line 30 at r1 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Didn't get last comment, in what case they errors out?

if we start znet with integrationtest-module, then passing ibc info to test binary will error out.

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 all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @ysv)

a discussion (no related file):
I still encourage to consider lazy-loading. The less code in init the better



integration-tests/init.go line 50 at r2 (raw file):

var (
	ctx          context.Context
	ChainsHolder Chains

I liked "Chains" more

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: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/init.go line 50 at r2 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

I liked "Chains" more

Me too

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, @wojtek-coreum, and @ysv)

a discussion (no related file):

Previously, wojtek-coreum (Wojtek) wrote…

I still encourage to consider lazy-loading. The less code in init the better

Done.



integration-tests/init.go line 50 at r2 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Me too

Me too.
but suggest names for the struct so the name will not conflict with var name. I am out of ideas.

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, @wojtek-coreum, and @ysv)

a discussion (no related file):

Previously, miladz68 (milad) wrote…

Done.

Actually trying to this seems unnecesarily complicated. since the current solution works, it is good enough.


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: all files reviewed, 2 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)


integration-tests/init.go line 50 at r2 (raw file):

Previously, miladz68 (milad) wrote…

Me too.
but suggest names for the struct so the name will not conflict with var name. I am out of ideas.

Decided to use NewCoreumTestingContext and NewChainsTestingContext for the initialisation.

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: 0 of 5 files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/init.go line 50 at r2 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Decided to use NewCoreumTestingContext and NewChainsTestingContext for the initialisation.

Done.

@ysv ysv requested a review from wojtek-coreum July 21, 2023 10:08
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 5 of 5 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @miladz68, @silverspase, and @wojtek-coreum)


integration-tests/init.go line 153 at r3 (raw file):

// GetGaiaChain returns the configured gaia chain.
func GetGaiaChain(t *testing.T) Chain {

you keep these methods in integration-tests not ibc on purpose, right ?
Because I thought maybe it makes sense to move it to ibc.
On the other hand we should still keep flags in integration-tests


integration-tests/ibc/asset_ft_test.go line 340 at r3 (raw file):

	t.Parallel()

	ctx, coreumChain := integrationtests.NewCoreumTestingContext(t)

when we were on the call I proposed idea to keep the interface of NewCoreumTestingContext(t) and trigger lazy loading inside it.

So NewCoreumTestingContext should still return chains as slice and call GetGaiaChain & GetOsmosisChain inside. The main idea was to keep same funcs & their interfaces.

Benefit of your approach is that you init what you actually need I think.

But if you prefer current version I'm ok to discuss.

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: 1 of 5 files reviewed, 3 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)


integration-tests/init.go line 153 at r3 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

you keep these methods in integration-tests not ibc on purpose, right ?
Because I thought maybe it makes sense to move it to ibc.
On the other hand we should still keep flags in integration-tests

My understanding of the discussion on the call was that it makes sense to keep the flag definition and variable initialization in the same place, and not to distribute the logic. this was the argument against using separate init functions.


integration-tests/ibc/asset_ft_test.go line 340 at r3 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

when we were on the call I proposed idea to keep the interface of NewCoreumTestingContext(t) and trigger lazy loading inside it.

So NewCoreumTestingContext should still return chains as slice and call GetGaiaChain & GetOsmosisChain inside. The main idea was to keep same funcs & their interfaces.

Benefit of your approach is that you init what you actually need I think.

But if you prefer current version I'm ok to discuss.

since we are using lazy loading and defining new functions anyways, the struct is not really helpful anyways, so I decided to remove it.

ysv
ysv previously approved these changes Jul 21, 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 4 of 4 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @silverspase and @wojtek-coreum)

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: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @silverspase, and @wojtek-coreum)


integration-tests/init.go line 153 at r4 (raw file):

// GetGaiaChain returns the configured gaia chain.
func GetGaiaChain(t *testing.T) Chain {

But we agreed to do the initialisation on integrationtests.NewCoreumTestingContext(t)
@ysv right?

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: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @silverspase, and @wojtek-coreum)


integration-tests/init.go line 153 at r4 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

But we agreed to do the initialisation on integrationtests.NewCoreumTestingContext(t)
@ysv right?

Same for the integrationtests.NewChains. In that case you won't even need to update tests.

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, @wojtek-coreum, and @ysv)


integration-tests/init.go line 153 at r4 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Same for the integrationtests.NewChains. In that case you won't even need to update tests.

that would defeat the purpose of this PR, the purpose is to initialize the first time it is needed. if it is initialized in NewCoreumTestingContext, then it will error out in case IBC components are not started but znet.

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: 1 of 5 files reviewed, 2 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)


integration-tests/init.go line 50 at r2 (raw file):

Previously, miladz68 (milad) wrote…

Done.

Pushed new changes. review again


integration-tests/init.go line 153 at r4 (raw file):

Previously, miladz68 (milad) wrote…

that would defeat the purpose of this PR, the purpose is to initialize the first time it is needed. if it is initialized in NewCoreumTestingContext, then it will error out in case IBC components are not started but znet.

agreed, new changes are pushed now

@ysv ysv requested a review from dzmitryhil July 21, 2023 16:18
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 4 of 4 files at r6, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @silverspase, and @wojtek-coreum)

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: all files reviewed, 1 unresolved discussion (waiting on @vertex451 and @wojtek-coreum)

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 5 files at r3, 4 of 4 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @vertex451 and @wojtek-coreum)

@miladz68 miladz68 removed the request for review from wojtek-coreum July 24, 2023 13:08
@miladz68 miladz68 dismissed wojtek-coreum’s stale review July 24, 2023 13:27

wojtek is on holidays

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.

Dismissed @wojtek-coreum from a discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @vertex451)

@miladz68 miladz68 merged commit 219b2f2 into master Jul 24, 2023
@miladz68 miladz68 deleted the milad/ibc-integrationtests-init branch July 24, 2023 13:54
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