cli: set image version in tests to stamped binary version (#2485)

This commit is contained in:
Malte Poll 2023-10-20 11:41:56 +02:00 committed by GitHub
parent 5cd70ac58a
commit c3a0a7e156
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -577,7 +577,7 @@ func TestAttestation(t *testing.T) {
require.NoError(existingStateFile.WriteToFile(fileHandler, constants.StateFilename))
cfg := config.Default()
cfg.Image = "v0.0.0" // is the default version of the the CLI (before build injects the real version)
cfg.Image = constants.BinaryVersion().String()
cfg.RemoveProviderAndAttestationExcept(cloudprovider.QEMU)
cfg.Attestation.QEMUVTPM.Measurements[0] = measurements.WithAllBytes(0x00, measurements.Enforce, measurements.PCRMeasurementLength)
cfg.Attestation.QEMUVTPM.Measurements[1] = measurements.WithAllBytes(0x11, measurements.Enforce, measurements.PCRMeasurementLength)
@ -611,6 +611,9 @@ func TestAttestation(t *testing.T) {
assert.Error(err)
// make sure the error is actually a TLS handshake error
assert.Contains(err.Error(), "transport: authentication handshake failed")
if validationErr, ok := err.(*config.ValidationError); ok {
t.Log(validationErr.LongMessage())
}
}
type testValidator struct {