Skip to content

[CI]: rewrite compose test #4359

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

Merged
merged 1 commit into from
Jun 25, 2025
Merged

Conversation

apostasie
Copy link
Contributor

Tentatively fix #4146

@apostasie apostasie changed the title Rewrite compose test [CI]: rewrite compose test Jun 23, 2025
@apostasie apostasie changed the title [CI]: rewrite compose test [WIP] [CI]: rewrite compose test Jun 23, 2025
@apostasie apostasie marked this pull request as draft June 23, 2025 22:19
@apostasie apostasie marked this pull request as ready for review June 23, 2025 23:21
@apostasie apostasie changed the title [WIP] [CI]: rewrite compose test [CI]: rewrite compose test Jun 23, 2025
@apostasie apostasie mentioned this pull request Jun 23, 2025
@apostasie
Copy link
Contributor Author

Rebased on principles.

@apostasie
Copy link
Contributor Author

@AkihiroSuda AkihiroSuda added this to the v2.1.3 milestone Jun 25, 2025
helpers.Ensure("compose", "-f", data.Temp().Path("project-1", "compose.yaml"), "up", "-d")
helpers.Ensure("compose", "-f", data.Temp().Path("project-2", "compose.yaml"), "up", "-d")
helpers.Ensure("compose", "-f", data.Temp().Path("project-2", "compose.yaml"), "down", "-v")
helpers.Ensure("compose", "-f", data.Temp().Path("project-2", "compose.yaml"), "up", "-d")
Copy link
Member

Choose a reason for hiding this comment

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

Why call data.Temp() multiple times?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

data.Temp() is just an accessor.

Alternatively we could hold a ref to the returned value, but that would probably be exactly the same thing as the compiler should inline the function call.

Anyhow, if you prefer it changed to call once and keep a ref on it for readability, that is fine with me of course, so, just lmk.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I have always been curious what the compared cost of a function call versus having variables moved to the heap (I assume the later is much more costly).

(sometimes I wish I would know more about how a compiler works...)

Copy link
Member

Choose a reason for hiding this comment

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

Not sure if the compiler is smart enough to detect that Temp() is idempotent and safe to inlinize it.

I'd still prefer this to be called just once, but no strong opinion.

Copy link
Contributor Author

@apostasie apostasie Jun 25, 2025

Choose a reason for hiding this comment

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

Interesting conversation.

The compiler will inline this (which is the pattern used here):

package main

type Bar struct {
}

type Foo struct {
	pv *Bar
}

func (f *Foo) PV() *Bar {
	return f.pv
}

func New() *Foo {
	return &Foo{pv: &Bar{}}
}

func main() {
	f := New()
	f.PV()
	f.PV()
	f.PV()
}
./main.go:20:6: inlining call to (*Foo).PV
./main.go:21:6: inlining call to (*Foo).PV
./main.go:22:6: inlining call to (*Foo).PV

Whether this happens in the context of tests is an open question though.


I'd still prefer this to be called just once, but no strong opinion.

Sure.
Let me do it now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Latest push has the change ^.

@apostasie
Copy link
Contributor Author

Rebased.

Signed-off-by: apostasie <spam_blackhole@farcloser.world>
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit c1dcfa4 into containerd:main Jun 25, 2025
38 checks passed
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.

[CI]: TestComposeUpWithExternalNetwork network failure
2 participants