-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
add go integrate test #1792
add go integrate test #1792
Changes from 18 commits
37558c4
eff05af
0f5351c
0013131
958730b
c3a25f4
fc0d3dd
02be838
444e6d3
cb8bda1
301e599
780da7f
ad89658
de90d53
da62b85
859436b
663c12c
cdd09f8
e4a8048
86501ad
13755aa
db1428f
c1f6c83
bc91da9
d50a0f5
4f83245
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,11 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: cache dependencies | ||
uses: actions/cache@v2 | ||
id: cache | ||
|
@@ -69,6 +74,13 @@ jobs: | |
python3 ../tests/integration/pika_replication_test.py | ||
python3 ../tests/unit/Blpop_Brpop_test.py | ||
|
||
- name: Run Go E2E Tests | ||
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
cd ../tests/integration/ | ||
chmod +x integrate_test.sh | ||
sh integrate_test.sh | ||
|
||
build_on_centos: | ||
runs-on: ubuntu-latest | ||
container: | ||
|
@@ -123,12 +135,24 @@ jobs: | |
python3 ../tests/integration/pika_replication_test.py | ||
python3 ../tests/unit/Blpop_Brpop_test.py | ||
|
||
- name: Run Go E2E Tests | ||
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
cd ../tests/integration/ | ||
chmod +x integrate_test.sh | ||
sh integrate_test.sh | ||
|
||
build_on_macos: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: cache dependencies | ||
uses: actions/cache@v2 | ||
id: cache | ||
|
@@ -175,4 +199,11 @@ jobs: | |
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
python3 ../tests/integration/pika_replication_test.py | ||
python3 ../tests/unit/Blpop_Brpop_test.py | ||
python3 ../tests/unit/Blpop_Brpop_test.py | ||
|
||
- name: Run Go E2E Tests | ||
working-directory: ${{ github.workspace }}/build | ||
run: | | ||
cd ../tests/integration/ | ||
chmod +x integrate_test.sh | ||
sh integrate_test.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code Review:
Improvement Suggestions:
Bug Risk: Overall, the code seems to follow a reasonable structure for running tests using different job configurations. However, a more detailed review of the actual test implementations would be necessary to identify any potential issues or improvements specific to the tests themselves. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overall, the code patch appears to add Go E2E tests and make use of the
Remember to thoroughly test and validate the modified pipeline in a staging or non-production environment before deploying it to production. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package pika_integration | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
. "github.com/bsm/ginkgo/v2" | ||
. "github.com/bsm/gomega" | ||
"github.com/redis/go-redis/v9" | ||
) | ||
|
||
var _ = Describe("Csanning Commands", func() { | ||
ctx := context.TODO() | ||
var client *redis.Client | ||
|
||
BeforeEach(func() { | ||
client = redis.NewClient(pikarOptions1()) | ||
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred()) | ||
}) | ||
|
||
AfterEach(func() { | ||
Expect(client.Close()).NotTo(HaveOccurred()) | ||
}) | ||
|
||
Describe("scanning", func() { | ||
It("should Scan", func() { | ||
for i := 0; i < 1000; i++ { | ||
set := client.Set(ctx, fmt.Sprintf("key%d", i), "hello", 0) | ||
Expect(set.Err()).NotTo(HaveOccurred()) | ||
} | ||
|
||
keys, cursor, err := client.Scan(ctx, 0, "", 0).Result() | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(keys).NotTo(BeEmpty()) | ||
Expect(cursor).NotTo(BeZero()) | ||
}) | ||
|
||
It("should ScanType", func() { | ||
for i := 0; i < 1000; i++ { | ||
set := client.Set(ctx, fmt.Sprintf("key%d", i), "hello", 0) | ||
Expect(set.Err()).NotTo(HaveOccurred()) | ||
} | ||
|
||
keys, cursor, err := client.ScanType(ctx, 0, "", 0, "").Result() | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(keys).NotTo(BeEmpty()) | ||
Expect(cursor).NotTo(BeZero()) | ||
}) | ||
|
||
It("should SScan", func() { | ||
for i := 0; i < 1000; i++ { | ||
sadd := client.SAdd(ctx, "myset", fmt.Sprintf("member%d", i)) | ||
Expect(sadd.Err()).NotTo(HaveOccurred()) | ||
} | ||
|
||
keys, cursor, err := client.SScan(ctx, "myset", 0, "", 0).Result() | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(keys).NotTo(BeEmpty()) | ||
Expect(cursor).NotTo(BeZero()) | ||
}) | ||
|
||
It("should HScan", func() { | ||
for i := 0; i < 1000; i++ { | ||
sadd := client.HSet(ctx, "myhash", fmt.Sprintf("key%d", i), "hello") | ||
Expect(sadd.Err()).NotTo(HaveOccurred()) | ||
} | ||
|
||
keys, cursor, err := client.HScan(ctx, "myhash", 0, "", 0).Result() | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(keys).NotTo(BeEmpty()) | ||
Expect(cursor).NotTo(BeZero()) | ||
}) | ||
|
||
It("should ZScan", func() { | ||
for i := 0; i < 1000; i++ { | ||
err := client.ZAdd(ctx, "myset", redis.Z{ | ||
Score: float64(i), | ||
Member: fmt.Sprintf("member%d", i), | ||
}).Err() | ||
Expect(err).NotTo(HaveOccurred()) | ||
} | ||
|
||
keys, cursor, err := client.ZScan(ctx, "myset", 0, "", 0).Result() | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(keys).NotTo(BeEmpty()) | ||
Expect(cursor).NotTo(BeZero()) | ||
}) | ||
}) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overall, the code patch appears to be a test suite for scanning commands in a Redis client. Here are some observations and suggestions for improvement:
Note: A code review is typically more effective when reviewing the entire context, including other relevant files, libraries used, and project-specific requirements. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overall, the code patch appears to be a test suite for scanning commands in a Redis database using the Pika integration library. Here are some observations and suggestions for improvement:
Remember to validate this code review independently before applying any suggested changes, as I can only provide a general assessment based on the provided code snippet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some observations and suggestions for the code patch:
In all three jobs (
build_on_ubuntu
,build_on_centos
,build_on_macos
), there is a duplication of steps related to running Go E2E tests. It could be abstracted into a reusable template to avoid repetition.The file paths used in script execution (
python3 ../tests/integration/pika_replication_test.py
andpython3 ../tests/unit/Blpop_Brpop_test.py
) should be validated to ensure they exist in the expected locations.It's recommended to specify the exact version of actions being used (e.g.,
actions/checkout@v3
) to keep the behavior consistent, rather than relying on the default version.Consider providing more information or details in the comments about what each job and step does, especially if it's not immediately clear from the context.
Overall, the code patch appears to be fine as long as the referenced files and directories exist and are correctly placed.
Note: It's helpful to provide more details or specific areas you want to address for a more comprehensive review.