Skip to content

[CI]: rewrite compose test - #4359

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
apostasie:2025-06-fix-4146
Jun 25, 2025
Merged

AkihiroSuda merged 1 commit into
containerd:mainfrom
apostasie:2025-06-fix-4146

Conversation

@apostasie

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Rebased on principles.

@apostasie

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@apostasie apostasie Jun 25, 2025 •

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
Contributor Author

Rebased.

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

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
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