-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
TestEnvVarValue fails on several architectures #14819
Comments
All build logs can be seen from https://buildd.debian.org/status/package.php?p=libpod&suite=experimental which currently looks like this (click on "Build-Attempted" in the status column): |
Also, this has been reported as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1014309 |
I don't think the TestEnvVarValue test is correct. It should not compare pointers there, I don't understand how this even works on x86_64. |
I tend to concur: podman/pkg/specgen/generate/kube/play_test.go Lines 778 to 790 in edcbcfd
indicates that |
From https://pkg.go.dev/github.com/stretchr/testify/assert#Equal
So the test already compares by value even if pass pointers, therefore the test works. The test case converts directly the int64 memtotal value from ReadMemInfo() info to an string. The actual code seems to cast it to and int: https://github.com/containers/podman/blob/main/pkg/specgen/generate/kube/kube.go#L813 @siretart Can you test it again with this diff applied? $ git diff
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index 689c740f0..39e15f950 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -810,8 +810,8 @@ func envVarValueResourceFieldRef(env v1.EnvVar, opts *CtrSpecGenOptions) (*strin
}
// k8s rounds up the result to the nearest integer
- intValue := int(math.Ceil(value.AsApproximateFloat64() / divisor.AsApproximateFloat64()))
- stringValue := strconv.Itoa(intValue)
+ intValue := int64(math.Ceil(value.AsApproximateFloat64() / divisor.AsApproximateFloat64()))
+ stringValue := strconv.FormatInt(intValue, 10)
return &stringValue, nil
} |
I can (probably) upload a new package with that patch applied later today. I guess the failure in TestMonitorTwoDirGood is unrelated? -- would you prefer a separate issue for that? |
Yes a new issue for the other failure would be good, I haven't looked at that one. |
@Luap99 yes, I can confirm that your patch makes the test pass on
|
Isn't this the same failure you mentioned above already? |
I took a look at the full log and I do not see any errors with the TestMonitorTwoDirGood tests. All are passing. The output are just logs that are expected. If you scroll further you find this:
|
Indeed, it is. Thanks, the log is quite long, and I was mistakenly looking for Further down in the log, I see this:
It seems that this test was written to only compile on Thanks for helping me navigate reading the log! |
You can just skip the pkg/machine test for now. AFAIK the code should be used but only for amd64 and arm64 builds. I will open a PR to fix the missing build tags on the tests. |
int can be 32 or 64 bit depending on the architecture. The total memory is int64 so we have to use int64 for the value as well otherwise we get an overflow on 32 bit systems. Fixes containers#14819 Signed-off-by: Paul Holzinger <[email protected]>
@siretart I think #14823 should fix all your issues, you can use this patch: https://patch-diff.githubusercontent.com/raw/containers/podman/pull/14823.patch |
Awesome, I've uploaded your patch as version Thank you! |
/kind bug
Description
I've updated the Debian package to version 4.1, and while the package builds and seeimgly works fine on amd64 and arm64, any other architectures fail while running the testsuite. I've seen two kind of failures:
On:
The test TestEnvVarValue fails with this output:
I note that these are all 32bit architectures, and the test fails while comparing a pointer.
There is a different failure signature on:
(at least that's what I think fails).
I note that all these architectures are 64bit.
The text was updated successfully, but these errors were encountered: