From 29b28ef840ce8dce4933137e2805c2af310a707b Mon Sep 17 00:00:00 2001
From: Ian Shim <shim@fastmail.com>
Date: Thu, 19 Dec 2024 11:47:35 -0800
Subject: [PATCH] fix v2 integration test

---
 inabox/tests/integration_v2_test.go | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/inabox/tests/integration_v2_test.go b/inabox/tests/integration_v2_test.go
index c020e6253..97f299c49 100644
--- a/inabox/tests/integration_v2_test.go
+++ b/inabox/tests/integration_v2_test.go
@@ -93,7 +93,7 @@ var _ = Describe("Inabox v2 Integration", func() {
 				Expect(batchHeader1.GetReferenceBlockNumber()).To(BeNumerically(">", 0))
 				attestation := reply1.GetSignedBatch().GetAttestation()
 				Expect(attestation).To(Not(BeNil()))
-				Expect(attestation.QuorumNumbers).To(Equal([]uint32{0, 1}))
+				Expect(attestation.QuorumNumbers).To(ConsistOf([]uint32{0, 1}))
 				Expect(len(attestation.NonSignerPubkeys)).To(Equal(0))
 				Expect(attestation.ApkG2).To(Not(BeNil()))
 				Expect(len(attestation.QuorumApks)).To(Equal(2))
@@ -121,11 +121,26 @@ var _ = Describe("Inabox v2 Integration", func() {
 				Expect(batchHeader2.GetReferenceBlockNumber()).To(BeNumerically(">", 0))
 				attestation = reply2.GetSignedBatch().GetAttestation()
 				Expect(attestation).To(Not(BeNil()))
-				Expect(attestation.QuorumNumbers).To(Equal([]uint32{0, 1}))
-				Expect(len(attestation.NonSignerPubkeys)).To(Equal(0))
-				Expect(attestation.ApkG2).To(Not(BeNil()))
-				Expect(len(attestation.QuorumApks)).To(Equal(2))
-				Expect(attestation.QuorumSignedPercentages).To(Equal([]byte{100, 100}))
+
+				if bytes.Equal(batchHeader2.BatchRoot, batchHeader1.BatchRoot) {
+					// same batch
+					attestation2 := reply2.GetSignedBatch().GetAttestation()
+					Expect(attestation2).To(Not(BeNil()))
+					Expect(attestation2.QuorumNumbers).To(Equal(attestation.QuorumNumbers))
+					Expect(len(attestation2.NonSignerPubkeys)).To(Equal(len(attestation.NonSignerPubkeys)))
+					Expect(attestation2.ApkG2).To(Equal(attestation.ApkG2))
+					Expect(len(attestation2.QuorumApks)).To(Equal(len(attestation.QuorumApks)))
+					Expect(attestation2.QuorumSignedPercentages).To(Equal(attestation.QuorumSignedPercentages))
+				} else {
+					attestation = reply2.GetSignedBatch().GetAttestation()
+					Expect(attestation).To(Not(BeNil()))
+					Expect(attestation.QuorumNumbers).To(ConsistOf([]uint32{0}))
+					Expect(len(attestation.NonSignerPubkeys)).To(Equal(0))
+					Expect(attestation.ApkG2).To(Not(BeNil()))
+					Expect(len(attestation.QuorumApks)).To(Equal(1))
+					Expect(attestation.QuorumSignedPercentages).To(Equal([]byte{100}))
+				}
+
 				blobVerification = reply2.GetBlobVerificationInfo()
 				Expect(blobVerification).To(Not(BeNil()))
 				Expect(blobVerification.GetBlobCertificate()).To(Not(BeNil()))