Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions compliance/compliance.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ var (
Fn: ModifyConnectionSinglePrimaryPreserve,
ShortName: "Modify RPC Connection with invalid persist/redundancy parameters",
},
}, {
In: Test{
Fn: ModifyConnectionRepeatedSessionParameters,
ShortName: "Modify RPC Connection with repeated SessionParameters",
},
}, {
In: Test{
Fn: InvalidElectionIDAndAFTOperation,
Expand Down Expand Up @@ -785,6 +790,37 @@ func InvalidParamsAndAFTOperation(c *fluent.GRIBIClient, t testing.TB, _ ...Test
chk.HasRecvClientErrorWithStatus(t, err, want, chk.IgnoreDetails())
}

// ModifyConnectionRepeatedSessionParameters validates that the server returns an error when a client
// specifies session parameters more than once on a stream.
func ModifyConnectionRepeatedSessionParameters(c *fluent.GRIBIClient, t testing.TB, _ ...TestOpt) {
defer electionID.Inc()
c.Connection().WithRedundancyMode(fluent.ElectedPrimaryClient).WithPersistence().WithInitialElectionID(electionID.Load(), 0)
c.Start(context.Background(), t)
defer c.Stop(t)

c.StartSending(context.Background(), t)

// Inject a second session parameters message.
c.Modify().InjectRequest(t, &spb.ModifyRequest{
Params: &spb.SessionParameters{
Redundancy: spb.SessionParameters_SINGLE_PRIMARY,
Persistence: spb.SessionParameters_PRESERVE,
},
})

err := awaitTimeout(context.Background(), c, t, time.Minute)
if err == nil {
t.Fatal("did not get expected error from server, got: nil")
}
t.Logf("Received error from server: %v", err)

want := fluent.ModifyError().
WithCode(codes.FailedPrecondition).
AsStatus(t)

chk.HasRecvClientErrorWithStatus(t, err, want, chk.IgnoreDetails())
}

// AddIPv4Entry adds a fully referenced IPv4Entry and checks whether the specified ACK
// type (wantACK) is returned.
func AddIPv4Entry(c *fluent.GRIBIClient, wantACK fluent.ProgrammingResult, t testing.TB, _ ...TestOpt) {
Expand Down
Loading