Add test for storing state just under the size limit of the Consul backend

Storing a state just a bit smaller than the limit of the KV API fails
because we are using the Transaction API which has an overhead.
This commit is contained in:
Rémi Lapeyre 2021-05-28 21:23:03 +02:00
parent abf7f3416b
commit e5fb84a01a
1 changed files with 13 additions and 5 deletions

View File

@ -136,11 +136,6 @@ func TestConsul_largeState(t *testing.T) {
t.Fatal(err)
}
// md5 := md5.Sum(payload)
// if !bytes.Equal(md5[:], remote.MD5) {
// t.Fatal("the md5 sums do not match")
// }
if !bytes.Equal(payload, remote.Data) {
t.Fatal("the data do not match")
}
@ -161,6 +156,19 @@ func TestConsul_largeState(t *testing.T) {
},
)
// This payload is just short enough to be stored but will be bigger when
// going through the Transaction API as it will be base64 encoded
testPayload(
t,
map[string]string{
"foo": strings.Repeat("a", 524288-10),
},
[]string{
"tf-unit/test-large-state",
"tf-unit/test-large-state/tfstate.4f407ace136a86521fd0d366972fe5c7/0",
},
)
// We try to replace the payload with a small one, the old chunks should be removed
testPayload(
t,