-
Notifications
You must be signed in to change notification settings - Fork 2.5k
WIP: mock maintnotif tests #3639
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
Draft
ndyakov
wants to merge
19
commits into
ndyakov/feature/CAE-1313-maint-cluster
Choose a base branch
from
ndyakov/CAE-1910-proxy-tests
base: ndyakov/feature/CAE-1313-maint-cluster
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f3e9126
lazy cluster topology reload
ndyakov 6ed2349
Merge branch 'ndyakov/feature/CAE-1313-maint-cluster' into ndyakov/CA…
ndyakov e9da546
fix discrepancies between options structs
ndyakov 644a1aa
Merge branch 'ndyakov/feature/CAE-1313-maint-cluster' into ndyakov/CA…
ndyakov fc05874
Update osscluster_lazy_reload_test.go
ndyakov f3bab0d
Update osscluster.go
ndyakov 60c6edc
wip fault with mock proxy
ndyakov 1902cbb
Merge branch 'ndyakov/feature/CAE-1313-maint-cluster' into ndyakov/CA…
ndyakov 853c7f2
Merge branch 'ndyakov/feature/CAE-1313-maint-cluster' into ndyakov/CA…
ndyakov 908d602
make lint happy
ndyakov aa1f970
fix linter issues
ndyakov e097b3e
faster tests with mocks
ndyakov ce7fb37
linter once again
ndyakov e390e2d
Merge branch 'ndyakov/feature/CAE-1313-maint-cluster' into ndyakov/CA…
ndyakov 3923484
add complex node test
ndyakov 7971f01
add ci e2e
ndyakov 8e4ea91
use correct redis container
ndyakov 7decf55
e2e fix
ndyakov 0707728
Merge branch 'ndyakov/feature/CAE-1313-maint-cluster' into ndyakov/CA…
ndyakov 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: E2E Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master, v9, 'v9.*'] | ||
| pull_request: | ||
| branches: [master, v9, v9.7, v9.8, 'ndyakov/**', 'ofekshenawa/**', 'ce/**'] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test-e2e-mock: | ||
| name: E2E Tests (Mock Proxy) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| go-version: | ||
| - "1.23.x" | ||
| - stable | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up Go ${{ matrix.go-version }} | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: ${{ matrix.go-version }} | ||
|
|
||
| - name: Start Docker services for E2E tests | ||
| run: make docker.e2e.start | ||
|
|
||
| - name: Wait for services to be ready | ||
| run: | | ||
| echo "Waiting for Redis to be ready..." | ||
| timeout 30 bash -c 'until docker exec redis-standalone redis-cli ping 2>/dev/null; do sleep 1; done' | ||
| echo "Waiting for cae-resp-proxy to be ready..." | ||
| timeout 30 bash -c 'until curl -s http://localhost:18100/stats > /dev/null; do sleep 1; done' | ||
| echo "All services are ready!" | ||
|
|
||
| - name: Run E2E tests with mock proxy | ||
| env: | ||
| E2E_SCENARIO_TESTS: "true" | ||
| run: | | ||
| go test -v ./maintnotifications/e2e/ -timeout 30m -race | ||
| continue-on-error: false | ||
|
|
||
| - name: Stop Docker services | ||
| if: always() | ||
| run: make docker.e2e.stop | ||
|
|
||
| - name: Show Docker logs on failure | ||
| if: failure() | ||
| run: | | ||
| echo "=== Redis logs ===" | ||
| docker logs redis-standalone 2>&1 | tail -100 | ||
| echo "=== cae-resp-proxy logs ===" | ||
| docker logs cae-resp-proxy 2>&1 | tail -100 | ||
| echo "=== proxy-fault-injector logs ===" | ||
| docker logs proxy-fault-injector 2>&1 | tail -100 | ||
|
|
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,43 @@ | ||
| # Build stage | ||
| FROM golang:1.21-alpine AS builder | ||
|
|
||
| WORKDIR /build | ||
|
|
||
| # Copy go mod files | ||
| COPY go.mod go.sum ./ | ||
| RUN go mod download | ||
|
|
||
| # Copy source code | ||
| COPY . . | ||
|
|
||
| # Build the proxy-fi-server binary | ||
| RUN cd maintnotifications/e2e/cmd/proxy-fi-server && \ | ||
| CGO_ENABLED=0 GOOS=linux go build -o /proxy-fi-server . | ||
|
|
||
| # Runtime stage | ||
| FROM alpine:latest | ||
|
|
||
| RUN apk --no-cache add ca-certificates | ||
|
|
||
| # Create a non-root user | ||
| RUN addgroup -g 1000 appuser && \ | ||
| adduser -D -u 1000 -G appuser appuser | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy the binary from builder | ||
| COPY --from=builder /proxy-fi-server . | ||
|
|
||
| # Change ownership of the app directory | ||
| RUN chown -R appuser:appuser /app | ||
|
|
||
| # Switch to non-root user | ||
| USER appuser | ||
|
|
||
| # Expose the fault injector API port | ||
| EXPOSE 5000 | ||
|
|
||
| # Run the server | ||
| ENTRYPOINT ["/app/proxy-fi-server"] | ||
ndyakov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CMD ["--listen", "0.0.0.0:5000", "--proxy-api-url", "http://cae-resp-proxy:3000"] | ||
|
|
||
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,43 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "flag" | ||
| "fmt" | ||
| "os" | ||
| "os/signal" | ||
| "syscall" | ||
|
|
||
| e2e "github.com/redis/go-redis/v9/maintnotifications/e2e" | ||
| ) | ||
|
|
||
| func main() { | ||
| listenAddr := flag.String("listen", "0.0.0.0:5000", "Address to listen on for fault injector API") | ||
| proxyAPIURL := flag.String("proxy-api-url", "http://localhost:18100", "URL of the cae-resp-proxy API (updated to avoid macOS Control Center conflict)") | ||
| flag.Parse() | ||
|
|
||
| fmt.Printf("Starting Proxy Fault Injector Server...\n") | ||
| fmt.Printf(" Listen address: %s\n", *listenAddr) | ||
| fmt.Printf(" Proxy API URL: %s\n", *proxyAPIURL) | ||
|
|
||
| server := e2e.NewProxyFaultInjectorServerWithURL(*listenAddr, *proxyAPIURL) | ||
| if err := server.Start(); err != nil { | ||
| fmt.Fprintf(os.Stderr, "Failed to start server: %v\n", err) | ||
| os.Exit(1) | ||
| } | ||
|
|
||
| fmt.Printf("Proxy Fault Injector Server started successfully\n") | ||
| fmt.Printf("Fault Injector API available at http://%s\n", *listenAddr) | ||
|
|
||
| // Wait for interrupt signal | ||
| sigChan := make(chan os.Signal, 1) | ||
| signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) | ||
| <-sigChan | ||
|
|
||
| fmt.Println("\nShutting down...") | ||
| if err := server.Stop(); err != nil { | ||
| fmt.Fprintf(os.Stderr, "Error during shutdown: %v\n", err) | ||
| os.Exit(1) | ||
| } | ||
| fmt.Println("Server stopped") | ||
| } | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
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.