-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Rabbitmq integration tests. #5757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 17 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
34782d5
cli: err about extensions for uninstall (#5723)
Pothulapati 1f02af8
Update debian base images to buster-20210208-slim (#5750)
olix0r f86b7ab
Update Go to 1.14.15 (#5751)
olix0r 06b1802
Update Ubuntu version in GitHub Actions (#5752)
olix0r 65f473b
tests: add exnternal-prometheus integration test (#5720)
Pothulapati e6db21f
Rabbitmq integration tests.
7eeb875
Fix erroneus package directory structure
a764d5d
Remove the external-resources flag. Add an option to run external res…
7033e50
Take care of format and linter issues. Decrease the waitperiod on dep…
1100e12
Change the helper methods to start standalone externalresource test
2a02d3f
Full SHA for github action (#5760)
alpeb b363166
templates: add 443 to skip ports if not present (#5638)
jimil749 d446895
Upgrade proxy-init to v1.3.9 (#5759)
alpeb 7373d56
Resolve conflict in helper file
6cc7c6e
Mistakenly added a golden file used in local testing. undoing
36a1fab
Fix merge conflict
ecae0d4
Fix merge conflict
e7b6975
Merge remote-tracking branch 'origin' into barkardk/rabbitmq-test
f5d7340
Use a fixed version of rabbitmq server and rabbitmq client for future…
243718f
Merge pull request #4 from linkerd/main
d82cdc1
Fix merge conflicts
41fe042
Merge pull request #5 from linkerd/main
d5a95a6
Merge remote-tracking branch 'origin' into barkardk/rabbitmq-test
4ab0691
Change function names to adhere to naming rules, tidy up the mod files
8a9de2c
Merge remote-tracking branch 'origin' into barkardk/rabbitmq-test
5ef77f5
Merge pull request #6 from linkerd/main
20eb14d
Merge remote-tracking branch 'origin' into barkardk/rabbitmq-test
920ae83
Merge remote-tracking branch 'origin' into barkardk/rabbitmq-test
701b6bd
Merge remote-tracking branch 'origin' into barkardk/rabbitmq-test
7c574d3
Merge remote-tracking branch 'origin' into barkardk/rabbitmq-test
dcda79a
Merge remote-tracking branch 'origin' into barkardk/rabbitmq-test
3c7cc59
Add new tests to the pipelines
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| package externalresources | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "os" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/linkerd/linkerd2/testutil" | ||
| ) | ||
|
|
||
| var TestHelper *testutil.TestHelper | ||
|
|
||
| func TestMain(m *testing.M) { | ||
| TestHelper = testutil.NewTestHelper() | ||
| os.Exit(m.Run()) | ||
| } | ||
|
|
||
| ////////////////////// | ||
| /// TEST EXECUTION /// | ||
| ////////////////////// | ||
|
|
||
| func TestRabbitMQDeploy(t *testing.T) { | ||
| ctx := context.Background() | ||
| TestHelper.WithDataPlaneNamespace(ctx, "rabbitmq-test", map[string]string{}, t, func(t *testing.T, testNamespace string) { | ||
| out, err := TestHelper.LinkerdRun("inject", "--manual", "testdata/rabbitmq-server.yaml") | ||
| // inject rabbitmq server | ||
| if err != nil { | ||
| testutil.AnnotatedFatalf(t, "'linkerd inject' command failed", "'linkerd inject' command failed: %s", err) | ||
| } | ||
| // deploy rabbitmq server | ||
| _, err = TestHelper.KubectlApply(out, testNamespace) | ||
| if err != nil { | ||
| testutil.AnnotatedFatalf(t, "kubectl apply command failed", "'kubectl apply' command failed: %s", err) | ||
| } | ||
| if err := TestHelper.CheckPods(ctx, testNamespace, "rabbitmq", 1); err != nil { | ||
| if rce, ok := err.(*testutil.RestartCountError); ok { | ||
| testutil.AnnotatedWarn(t, "CheckPods timed-out %s", rce) | ||
| } else { | ||
| testutil.AnnotatedError(t, "CheckPods timed-out %s", err) | ||
| } | ||
| } | ||
| if err := TestHelper.CheckDeployment(ctx, testNamespace, "rabbitmq", 1); err != nil { | ||
| testutil.AnnotatedErrorf(t, "CheckDeployment timed-out", "Error validating deployment [%s]: \n%s", "rabbitmq", err) | ||
| } | ||
| // inject rabbitmq-client | ||
| stdout, err := TestHelper.LinkerdRun("inject", "--manual", "testdata/rabbitmq-client.yaml") | ||
| if err != nil { | ||
| testutil.AnnotatedFatalf(t, "'linkerd inject' command failed", "'linkerd inject' command failed: %s", err) | ||
| } | ||
| // deploy rabbitmq client | ||
| _, err = TestHelper.KubectlApply(stdout, testNamespace) | ||
| if err != nil { | ||
| testutil.AnnotatedFatalf(t, "kubectl apply command failed", "'kubectl apply' command failed: %s", err) | ||
| } | ||
| if err := TestHelper.CheckPods(ctx, testNamespace, "rabbitmq-client", 1); err != nil { | ||
| if rce, ok := err.(*testutil.RestartCountError); ok { | ||
| testutil.AnnotatedWarn(t, "CheckPods timed-out %s", rce) | ||
| } else { | ||
| testutil.AnnotatedError(t, "CheckPods timed-out %s", err) | ||
| } | ||
| } | ||
| if err := TestHelper.CheckDeployment(ctx, testNamespace, "rabbitmq-client", 1); err != nil { | ||
| testutil.AnnotatedErrorf(t, "CheckDeployment timed-out", "Error validating deployment [%s]: \n%s", "rabbitmq", err) | ||
| } | ||
| // Verify client output | ||
| golden := "check.rabbitmq.golden" | ||
| timeout := 50 * time.Second | ||
| err = TestHelper.RetryFor(timeout, func() error { | ||
| out, err := TestHelper.Kubectl("", "-n", testNamespace, "logs", "-lapp=rabbitmq-client", "-crabbitmq-client") | ||
| if err != nil { | ||
| return fmt.Errorf("'kubectl logs -l app=rabbitmq-client -c rabbitmq-client' command failed\n%s", err) | ||
| } | ||
| err = TestHelper.ValidateOutput(out, golden) | ||
| if err != nil { | ||
| return fmt.Errorf("received unexpected output\n%s", err.Error()) | ||
| } | ||
| return nil | ||
| }) | ||
| if err != nil { | ||
| testutil.AnnotatedFatal(t, fmt.Sprintf("'kubectl logs' command timed-out (%s)", timeout), err) | ||
| } | ||
|
|
||
| }) | ||
|
|
||
| } |
3 changes: 3 additions & 0 deletions
3
test/integration/externalresources/testdata/check.rabbitmq.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [OK] Create message queue MQTestQueue | ||
| [OK] Published message. Message count: 1 | ||
| [OK] Consumed message. Message count: 0 |
31 changes: 31 additions & 0 deletions
31
test/integration/externalresources/testdata/rabbitmq-client.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| labels: | ||
| app: rabbitmq-client | ||
| name: rabbitmq-client | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: rabbitmq-client | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: rabbitmq-client | ||
| spec: | ||
| containers: | ||
| - image: ghcr.io/barkardk/rabbitmq-client:latest | ||
| name: rabbitmq-client | ||
| env: | ||
| - name: RABBITMQ_AMQP_CONN_STR | ||
| value: "amqp://guest:guest@rabbitmq:5672/" | ||
| command: | ||
| - "/bin/sh" | ||
| args: | ||
| - "-c" | ||
| - | | ||
| sleep 20 # wait for pods to start | ||
| ./mq_test | ||
| restartPolicy: Always | ||
|
|
59 changes: 59 additions & 0 deletions
59
test/integration/externalresources/testdata/rabbitmq-server.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| labels: | ||
| app: rabbitmq | ||
| name: rabbitmq | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: rabbitmq | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: rabbitmq | ||
| spec: | ||
| containers: | ||
| - image: rabbitmq:3-management | ||
| name: rabbitmq | ||
| livenessProbe: | ||
| exec: | ||
| command: | ||
| - rabbitmqctl | ||
| - status | ||
| failureThreshold: 6 | ||
| initialDelaySeconds: 10 | ||
| periodSeconds: 10 | ||
| successThreshold: 1 | ||
| timeoutSeconds: 5 | ||
| readinessProbe: | ||
| exec: | ||
| command: | ||
| - rabbitmqctl | ||
| - status | ||
| failureThreshold: 6 | ||
| initialDelaySeconds: 10 | ||
| periodSeconds: 10 | ||
| successThreshold: 1 | ||
| timeoutSeconds: 5 | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| labels: | ||
| app: rabbitmq | ||
| name: rabbitmq | ||
| spec: | ||
| ports: | ||
| - name: http | ||
| port: 15672 | ||
| protocol: TCP | ||
| targetPort: 15672 | ||
| - name: amqp | ||
| port: 5672 | ||
| protocol: TCP | ||
| targetPort: 5672 | ||
| selector: | ||
| app: rabbitmq | ||
| type: ClusterIP |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.