Skip to content

Commit 9b55044

Browse files
authored
Merge pull request #70 from rabbitmq/refactor-consolidate-ci
Consolidate GH workflows
2 parents 51559e6 + 4cb7a0d commit 9b55044

File tree

4 files changed

+48
-80
lines changed

4 files changed

+48
-80
lines changed

.ci/publish-documentation-to-github-pages.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/build-test.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
name: Test against supported go-version
22

33
on:
4-
- workflow_call
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
512

613
jobs:
714
build-ubuntu:
815
runs-on: ubuntu-latest
916
strategy:
10-
fail-fast: true
17+
fail-fast: false
1118
matrix:
1219
go:
1320
- stable

.github/workflows/main.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

pkg/rabbitmqamqp/amqp_connection_recovery_test.go

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -966,14 +966,19 @@ var _ = Describe("Recovery connection test", func() {
966966
})
967967
})
968968

969-
Context("end-to-end tests", func() {
969+
Context("end-to-end tests", FlakeAttempts(3), func() {
970970
var (
971-
env *Environment
972-
containerId string
971+
env *Environment
973972
)
974973

975-
BeforeEach(func() {
976-
containerId = CurrentSpecReport().LeafNodeText
974+
AfterEach(func(ctx context.Context) {
975+
if env != nil {
976+
env.CloseConnections(ctx)
977+
}
978+
})
979+
980+
It("should recover the topology", func(ctx context.Context) {
981+
const containerId = "recover-topology"
977982
env = NewEnvironment("amqp://", &AmqpConnOptions{
978983
TopologyRecoveryOptions: TopologyRecoveryOnlyTransient,
979984
ContainerID: containerId,
@@ -983,15 +988,8 @@ var _ = Describe("Recovery connection test", func() {
983988
BackOffReconnectInterval: 2 * time.Second,
984989
MaxReconnectAttempts: 5,
985990
},
986-
Id: containerId,
987991
})
988-
})
989992

990-
AfterEach(func(ctx context.Context) {
991-
env.CloseConnections(ctx)
992-
})
993-
994-
It("should recover the topology", func(ctx context.Context) {
995993
conn, err := env.NewConnection(ctx)
996994
Expect(err).ToNot(HaveOccurred())
997995

@@ -1057,6 +1055,18 @@ var _ = Describe("Recovery connection test", func() {
10571055
})
10581056

10591057
It("should not duplicate recovery records", func(ctx context.Context) {
1058+
const containerId = "not-duplicate-recovery-records"
1059+
env = NewEnvironment("amqp://", &AmqpConnOptions{
1060+
TopologyRecoveryOptions: TopologyRecoveryOnlyTransient,
1061+
ContainerID: containerId,
1062+
SASLType: amqp.SASLTypeAnonymous(),
1063+
RecoveryConfiguration: &RecoveryConfiguration{
1064+
ActiveRecovery: true,
1065+
BackOffReconnectInterval: 2 * time.Second,
1066+
MaxReconnectAttempts: 5,
1067+
},
1068+
})
1069+
10601070
conn, err := env.NewConnection(ctx)
10611071
Expect(err).ToNot(HaveOccurred())
10621072

@@ -1097,6 +1107,18 @@ var _ = Describe("Recovery connection test", func() {
10971107
})
10981108

10991109
It("recovers auto-gen queues", func(ctx context.Context) {
1110+
const containerId = "recover-auto-gen-queues"
1111+
env = NewEnvironment("amqp://", &AmqpConnOptions{
1112+
TopologyRecoveryOptions: TopologyRecoveryOnlyTransient,
1113+
ContainerID: containerId,
1114+
SASLType: amqp.SASLTypeAnonymous(),
1115+
RecoveryConfiguration: &RecoveryConfiguration{
1116+
ActiveRecovery: true,
1117+
BackOffReconnectInterval: 2 * time.Second,
1118+
MaxReconnectAttempts: 5,
1119+
},
1120+
})
1121+
11001122
conn, err := env.NewConnection(ctx)
11011123
Expect(err).ToNot(HaveOccurred())
11021124
ch := make(chan *StateChanged, 1)
@@ -1153,27 +1175,26 @@ func dropConnectionAndAwaitReconnectionByContainerID(containerID string, ch <-ch
11531175
// Drop connection
11541176
Eventually(func() error {
11551177
return testhelper.DropConnectionContainerID(containerID)
1156-
}).WithTimeout(5*time.Second).WithPolling(400*time.Millisecond).WithOffset(1).
1178+
}).WithTimeout(10*time.Second).WithPolling(500*time.Millisecond).WithOffset(1).
11571179
Should(Succeed(), "expected connection to be closed")
11581180
stateChange := new(StateChanged)
1159-
Eventually(ch).Within(5 * time.Second).WithPolling(400 * time.Millisecond).WithOffset(1).
1181+
Eventually(ch).Within(10 * time.Second).WithPolling(500 * time.Millisecond).WithOffset(1).
11601182
Should(Receive(&stateChange))
11611183
Expect(stateChange.From).To(Equal(&StateOpen{}))
11621184
Expect(stateChange.To).To(BeAssignableToTypeOf(&StateClosed{}))
11631185

11641186
// Receive reconnecting state
1165-
Eventually(ch).Within(5 * time.Second).WithPolling(400 * time.Millisecond).WithOffset(1).
1187+
Eventually(ch).Within(10 * time.Second).WithPolling(500 * time.Millisecond).WithOffset(1).
11661188
Should(Receive())
11671189

1168-
By("recovering the connection")
11691190
// Await reconnection
11701191
Eventually(func() (bool, error) {
11711192
conn, err := testhelper.GetConnectionByContainerID(containerID)
11721193
return conn != nil, err
1173-
}).WithTimeout(6 * time.Second).WithPolling(400 * time.Millisecond).WithOffset(1).
1194+
}).WithTimeout(10 * time.Second).WithPolling(500 * time.Millisecond).WithOffset(1).
11741195
Should(BeTrueBecause("expected connection to be reconnected"))
11751196
stateChange = new(StateChanged)
1176-
Eventually(ch).Within(5 * time.Second).WithPolling(400 * time.Millisecond).WithOffset(1).
1197+
Eventually(ch).Within(10 * time.Second).WithPolling(500 * time.Millisecond).WithOffset(1).
11771198
Should(Receive(&stateChange))
11781199
Expect(stateChange.To).To(Equal(&StateOpen{}))
11791200
}

0 commit comments

Comments
 (0)