Skip to content

Commit 58bac0d

Browse files
committed
feat: Add unit tests for reduce-stream-counter
1 parent 405bf61 commit 58bac0d

File tree

5 files changed

+311
-155
lines changed

5 files changed

+311
-155
lines changed
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
[package]
2-
name = "reduce-stream-counter"
3-
version = "0.1.0"
4-
edition.workspace = true
5-
rust-version.workspace = true
6-
7-
[dependencies]
8-
tonic.workspace = true
9-
tokio.workspace = true
10-
numaflow = { path = "../../numaflow" }
11-
1+
[package]
2+
name = "reduce-stream-counter"
3+
version = "0.1.0"
4+
edition.workspace = true
5+
rust-version.workspace = true
6+
7+
[dependencies]
8+
tonic.workspace = true
9+
tokio.workspace = true
10+
numaflow = { path = "../../numaflow" }
11+
12+
[dev-dependencies]
13+
chrono.workspace = true
14+
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
FROM rust:1.85-bullseye AS build
2-
3-
RUN apt-get update
4-
RUN apt-get install protobuf-compiler -y
5-
6-
WORKDIR /numaflow-rs
7-
COPY ./ ./
8-
WORKDIR /numaflow-rs/examples/reduce-stream-counter
9-
10-
# build for release
11-
RUN cargo build --release
12-
13-
# our final base
14-
FROM debian:bullseye AS reduce-stream-counter
15-
16-
# copy the build artifact from the build stage
17-
COPY --from=build /numaflow-rs/target/release/reduce-stream-counter .
18-
19-
# set the startup command to run your binary
20-
CMD ["./reduce-stream-counter"]
21-
1+
FROM rust:1.85-bullseye AS build
2+
3+
RUN apt-get update
4+
RUN apt-get install protobuf-compiler -y
5+
6+
WORKDIR /numaflow-rs
7+
COPY ./ ./
8+
WORKDIR /numaflow-rs/examples/reduce-stream-counter
9+
10+
# build for release
11+
RUN cargo build --release
12+
13+
# our final base
14+
FROM debian:bullseye AS reduce-stream-counter
15+
16+
# copy the build artifact from the build stage
17+
COPY --from=build /numaflow-rs/target/release/reduce-stream-counter .
18+
19+
# set the startup command to run your binary
20+
CMD ["./reduce-stream-counter"]
21+
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
TAG ?= stable
2-
PUSH ?= false
3-
IMAGE_REGISTRY = quay.io/numaio/numaflow-rs/reduce-stream-counter:${TAG}
4-
DOCKER_FILE_PATH = examples/reduce-stream-counter/Dockerfile
5-
6-
.PHONY: update
7-
update:
8-
cargo check
9-
cargo update
10-
11-
.PHONY: image
12-
image: update
13-
cd ../../ && docker build \
14-
-f ${DOCKER_FILE_PATH} \
15-
-t ${IMAGE_REGISTRY} .
16-
@if [ "$(PUSH)" = "true" ]; then docker push ${IMAGE_REGISTRY}; fi
17-
1+
TAG ?= stable
2+
PUSH ?= false
3+
IMAGE_REGISTRY = quay.io/numaio/numaflow-rs/reduce-stream-counter:${TAG}
4+
DOCKER_FILE_PATH = examples/reduce-stream-counter/Dockerfile
5+
6+
.PHONY: update
7+
update:
8+
cargo check
9+
cargo update
10+
11+
.PHONY: image
12+
image: update
13+
cd ../../ && docker build \
14+
-f ${DOCKER_FILE_PATH} \
15+
-t ${IMAGE_REGISTRY} .
16+
@if [ "$(PUSH)" = "true" ]; then docker push ${IMAGE_REGISTRY}; fi
17+
Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
apiVersion: numaflow.numaproj.io/v1alpha1
2-
kind: Pipeline
3-
metadata:
4-
name: simple-reduce-stream
5-
spec:
6-
vertices:
7-
- name: in
8-
source:
9-
# A self data generating source
10-
generator:
11-
rpu: 10
12-
duration: 1s
13-
keyCount: 5
14-
value: 5
15-
- name: streaming-counter
16-
udf:
17-
container:
18-
# count element with streaming results
19-
image: quay.io/numaio/numaflow-rs/reduce-stream-counter:stable
20-
groupBy:
21-
window:
22-
fixed:
23-
length: 10s
24-
streaming: true
25-
keyed: true
26-
storage:
27-
persistentVolumeClaim:
28-
volumeSize: 10Gi
29-
accessMode: ReadWriteOnce
30-
- name: out
31-
sink:
32-
# A simple log printing sink
33-
log: {}
34-
edges:
35-
- from: in
36-
to: streaming-counter
37-
- from: streaming-counter
38-
to: out
39-
1+
apiVersion: numaflow.numaproj.io/v1alpha1
2+
kind: Pipeline
3+
metadata:
4+
name: simple-reduce-stream
5+
spec:
6+
vertices:
7+
- name: in
8+
source:
9+
# A self data generating source
10+
generator:
11+
rpu: 10
12+
duration: 1s
13+
keyCount: 5
14+
value: 5
15+
- name: streaming-counter
16+
udf:
17+
container:
18+
# count element with streaming results
19+
image: quay.io/numaio/numaflow-rs/reduce-stream-counter:stable
20+
groupBy:
21+
window:
22+
fixed:
23+
length: 10s
24+
streaming: true
25+
keyed: true
26+
storage:
27+
persistentVolumeClaim:
28+
volumeSize: 10Gi
29+
accessMode: ReadWriteOnce
30+
- name: out
31+
sink:
32+
# A simple log printing sink
33+
log: {}
34+
edges:
35+
- from: in
36+
to: streaming-counter
37+
- from: streaming-counter
38+
to: out
39+

0 commit comments

Comments
 (0)