-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: e2e testing for PBQ WAL with reduce pipeline (#393)
Signed-off-by: Hao Hao <[email protected]>
- Loading branch information
Showing
5 changed files
with
151 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,97 @@ | ||
//go:build test | ||
|
||
/* | ||
Copyright 2022 The Numaproj Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package reduce_e2e | ||
|
||
import ( | ||
"strconv" | ||
"testing" | ||
"time" | ||
|
||
dfv1 "github.com/numaproj/numaflow/pkg/apis/numaflow/v1alpha1" | ||
. "github.com/numaproj/numaflow/test/fixtures" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type ReduceSuite struct { | ||
E2ESuite | ||
} | ||
|
||
func (s *ReduceSuite) TestSimpleReducePipelineFailOver() { | ||
w := s.Given().Pipeline("@testdata/simple-reduce-pipeline.yaml"). | ||
When(). | ||
CreatePipelineAndWait() | ||
defer w.DeletePipelineAndWait() | ||
|
||
pipelineName := "even-odd-sum" | ||
|
||
w.Expect().VertexPodsRunning() | ||
|
||
w.Expect(). | ||
VertexPodLogContains("in", LogSourceVertexStarted). | ||
VertexPodLogContains("atoi", LogUDFVertexStarted, PodLogCheckOptionWithContainer("numa")). | ||
VertexPodLogContains("sink", LogSinkVertexStarted). | ||
DaemonPodLogContains(pipelineName, LogDaemonStarted) | ||
|
||
defer w.VertexPodPortForward("in", 8443, dfv1.VertexHTTPSPort). | ||
TerminateAllPodPortForwards() | ||
|
||
args := "kubectl delete po -n numaflow-system -l " + | ||
"numaflow.numaproj.io/pipeline-name=even-odd-sum,numaflow.numaproj.io/vertex-name=compute-sum" | ||
|
||
// Kill the reducer pods before processing to trigger failover. | ||
w.Exec("/bin/sh", []string{"-c", args}, CheckPodKillSucceeded) | ||
|
||
startTime := int(time.Unix(1000, 0).UnixMilli()) | ||
for i := 1; i <= 100; i++ { | ||
eventTime := startTime + (i * 1000) | ||
if i == 5 { | ||
// Kill the reducer pods during processing to trigger failover. | ||
w.Expect().VertexPodsRunning() | ||
w.Exec("/bin/sh", []string{"-c", args}, CheckPodKillSucceeded) | ||
} | ||
|
||
HTTPExpect(s.T(), "https://localhost:8443").POST("/vertices/in").WithHeader("X-Numaflow-Event-Time", strconv.Itoa(eventTime)).WithBytes([]byte("1")). | ||
Expect(). | ||
Status(204) | ||
|
||
HTTPExpect(s.T(), "https://localhost:8443").POST("/vertices/in").WithHeader("X-Numaflow-Event-Time", strconv.Itoa(eventTime)).WithBytes([]byte("2")). | ||
Expect(). | ||
Status(204) | ||
|
||
HTTPExpect(s.T(), "https://localhost:8443").POST("/vertices/in").WithHeader("X-Numaflow-Event-Time", strconv.Itoa(eventTime)).WithBytes([]byte("3")). | ||
Expect(). | ||
Status(204) | ||
} | ||
|
||
w.Expect().VertexPodLogContains("sink", "Payload - 38", PodLogCheckOptionWithCount(1)) | ||
w.Expect().VertexPodLogContains("sink", "Payload - 76", PodLogCheckOptionWithCount(1)) | ||
w.Expect().VertexPodLogContains("sink", "Payload - 120", PodLogCheckOptionWithCount(1)) | ||
w.Expect().VertexPodLogContains("sink", "Payload - 240", PodLogCheckOptionWithCount(1)) | ||
|
||
// Kill the reducer pods after processing to trigger failover. | ||
w.Exec("/bin/sh", []string{"-c", args}, CheckPodKillSucceeded) | ||
w.Expect().VertexPodsRunning() | ||
w.Expect().VertexPodLogContains("sink", "Payload - 38", PodLogCheckOptionWithCount(1)) | ||
w.Expect().VertexPodLogContains("sink", "Payload - 76", PodLogCheckOptionWithCount(1)) | ||
w.Expect().VertexPodLogContains("sink", "Payload - 120", PodLogCheckOptionWithCount(1)) | ||
w.Expect().VertexPodLogContains("sink", "Payload - 240", PodLogCheckOptionWithCount(1)) | ||
} | ||
|
||
func TestReduceSuite(t *testing.T) { | ||
suite.Run(t, new(ReduceSuite)) | ||
} |
This file contains 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,45 @@ | ||
apiVersion: numaflow.numaproj.io/v1alpha1 | ||
kind: Pipeline | ||
metadata: | ||
name: even-odd-sum | ||
spec: | ||
limits: | ||
readBatchSize: 1 | ||
vertices: | ||
- name: in | ||
source: | ||
http: {} | ||
- name: atoi | ||
scale: | ||
min: 1 | ||
udf: | ||
container: | ||
# Tell the input number is even or odd, see https://github.com/numaproj/numaflow-go/tree/main/pkg/function/examples/evenodd | ||
image: quay.io/numaio/go-even-odd-example | ||
- name: compute-sum | ||
udf: | ||
container: | ||
# compute the sum | ||
image: quay.io/numaio/go-integer-sum-example | ||
groupBy: | ||
window: | ||
fixed: | ||
length: 60s | ||
keyed: true | ||
storage: | ||
persistentVolumeClaim: | ||
volumeSize: 10Gi | ||
accessMode: ReadWriteOnce | ||
- name: sink | ||
scale: | ||
min: 1 | ||
sink: | ||
log: {} | ||
edges: | ||
- from: in | ||
to: atoi | ||
- from: atoi | ||
to: compute-sum | ||
parallelism: 2 | ||
- from: compute-sum | ||
to: sink |