Skip to content

Commit

Permalink
[integration] - fixed ts number display, made test run even if previo…
Browse files Browse the repository at this point in the history
…us ones fail, changed test to use both py and ts delete
  • Loading branch information
LeonLiur committed Jul 8, 2024
1 parent a0eb3be commit e406cf0
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 24 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:
packages: write

jobs:
test-integration-ubuntu-mini:
test-integration-ubuntu:
runs-on: "Ubuntu"
timeout-minutes: 1440
steps:
Expand Down Expand Up @@ -61,11 +61,13 @@ jobs:
if: steps.filter.outputs.changed == 'true'
run: ./run-integration.sh tests/ws-d-r.json
working-directory: ./integration
continue-on-error: true

- name: Benchmark test
if: steps.filter.outputs.changd == 'true'
run: ./run-integration.sh tests/benchmark-test.json
working-directory: ./integration
continue-on-error: true

test-integration-windows:
runs-on: "Windows"
Expand Down Expand Up @@ -107,9 +109,11 @@ jobs:
shell: powershell
run: ./run-integration.ps1 tests/ws-d-r-mini.json
working-directory: ./integration
continue-on-error: true

- name: Benchmark Test
if: steps.filter.outputs.changed == 'true'
shell: powershell
run: ./run-integration.ps1 tests/benchmark-test-small.json
working-directory: ./integration
continue-on-error: true
4 changes: 2 additions & 2 deletions integration/py/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ def generate_test_report(
else "FAIL!!"
)
assertion_result = (
f"""Expected samples: {self._tc.samples_expected}; Actual samples: {samples}\n{assertion_passed}"""
f"""Expected samples: {self._tc.samples_expected:,.2f}; Actual samples: {samples:,.2f}\n{assertion_passed}"""
if self._tc.samples_expected != 0
else ""
)

s = f"""
-- Python Read ({self._tc.identifier})--
Samples read: {samples}
Samples read: {samples:,.2f}
Time taken: {time}
Calculated Samples per Second: {samples_per_second:,.2f}
Configuration:
Expand Down
4 changes: 2 additions & 2 deletions integration/py/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ def test_with_timing(self):
'''
s = f'''
-- Python Stream ({self._tc.identifier})--
Samples streamed: {samples}
Samples streamed: {samples:,.2f}
Time taken: {time}
Calculated Samples per Second: {samples_per_second:,.2f}
Configuration:
\tNumber of streamers: 1
\tNumber of channels: {len(self._tc.channels)}
\tSamples expected: {self._tc.samples_expected}
\tSamples expected: {self._tc.samples_expected:,.2f}
{err_assertion}
'''
Expand Down
2 changes: 1 addition & 1 deletion integration/py/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def generate_test_report(self, time: sy.TimeSpan, err_assertion: str) -> str:
samples_per_second = samples / (float(time) / float(sy.TimeSpan.SECOND))
s = f'''
-- Python Write ({self._tc.identifier}) --
Samples written: {samples}
Samples written: {samples:,.0f}
Time taken: {time}
Calculated Samples per Second: {samples_per_second:,.2f}
Configuration:
Expand Down
8 changes: 1 addition & 7 deletions integration/tests/ws-d-r-small.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@
{
"op": "stream",
"client": "ts",
"starts_after": [],
"params": {
"channels": [
"int0",
Expand All @@ -237,7 +236,6 @@
{
"op": "stream",
"client": "py",
"starts_after": [],
"params": {
"channels": [
"int1",
Expand All @@ -253,8 +251,7 @@
[
{
"op": "delete",
"client": "py",
"starts_after": [],
"client": "ts",
"params": {
"time_range": {
"start": 100000000000000,
Expand Down Expand Up @@ -299,7 +296,6 @@
{
"op": "delete",
"client": "py",
"starts_after": [],
"params": {
"time_range": {
"start": 100000000000000,
Expand Down Expand Up @@ -340,7 +336,6 @@
{
"op": "read",
"client": "py",
"starts_after": [],
"params": {
"num_iterators": 5,
"channel_groups": [
Expand Down Expand Up @@ -384,7 +379,6 @@
{
"op": "read",
"client": "ts",
"starts_after": [],
"params": {
"num_iterators": 5,
"channel_groups": [
Expand Down
2 changes: 1 addition & 1 deletion integration/tests/ws-d-r.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
},
{
"op": "delete",
"client": "py",
"client": "ts",
"starts_after": [],
"params": {
"time_range": {
Expand Down
9 changes: 6 additions & 3 deletions integration/ts/src/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ class ReadTest {
const time: TimeSpan = start.span(end);
const samplesPerSecond = samples / (Number(time) / Number(TimeSpan.SECOND));
const assertionPassed = this.tc.samplesExpected == 0 || approxEqual(samples, this.tc.samplesExpected);
const assertionResult = `Expected samples: ${this.tc.samplesExpected}; Actual samples: ${samples}`;
const assertionResult = `Expected samples: ${formatNumber(this.tc.samplesExpected)}; Actual samples: ${formatNumber(samples)}`;
const s = `
-- TypeScript Read (${this.tc.identifier}) --
Samples read: ${samples}
Samples read: ${formatNumber(samples)}
Time taken: ${time}
Calculated Samples per Second: ${samplesPerSecond.toFixed(2)}
Calculated Samples per Second: ${formatNumber(samplesPerSecond)}
Configuration:
\tNumber of iterators: ${this.tc.numIterators}
\tNumber of channels: ${this.tc.numChannels()}
Expand Down Expand Up @@ -152,6 +152,9 @@ Expected error: ${this.tc.expectedError}; Actual error: ${actualError}\n${errorA
}
}

function formatNumber(x: number): string {
return x.toFixed(2).toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}

async function main() {
try {
Expand Down
10 changes: 7 additions & 3 deletions integration/ts/src/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ class StreamTest {
const samplesPerSecond = samples / (Number(time) / Number(TimeSpan.SECOND));
const s = `
-- TypeScript Stream (${this.tc.identifier}) --
Samples streamed: ${samples}
Samples streamed: ${formatNumber(samples)}
Time taken: ${time}
Calculated Samples per Second: ${samplesPerSecond.toFixed(2)}
Calculated Samples per Second: ${formatNumber(samplesPerSecond)}
Configuration:
\tNumber of streamers: 1
\tNumber of channels: ${this.tc.channels.length}
\tSamples expected: ${this.tc.samplesExpected}
\tSamples expected: ${formatNumber(this.tc.samplesExpected)}
Expected error: ${this.tc.expectedError}; Actual error: ${actualError}\n${errorAssertion ? "PASS!!" : "FAIL!!"}
`;
Expand Down Expand Up @@ -114,6 +114,10 @@ Expected error: ${this.tc.expectedError}; Actual error: ${actualError}\n${errorA
}
}

function formatNumber(x: number): string {
return x.toFixed(2).toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}

async function main() {
try {
await new StreamTest(argv).testWithTiming()
Expand Down
12 changes: 8 additions & 4 deletions integration/ts/src/write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ class WriteTest {
const samplesPerSecond = samples / (Number(time) / Number(TimeSpan.SECOND));
const s = `
-- TypeScript Write (${this.tc.identifier}) --
Samples written: ${samples}
Samples written: ${formatNumber(samples)}
Time taken: ${time}
Calculated Samples per Second: ${samplesPerSecond.toFixed(2)}
Calculated Samples per Second: ${formatNumber(samplesPerSecond)}
Configuration:
\tNumber of writers: ${this.tc.numWriters}
\tNumber of channels: ${this.tc.numChannels()}
\tNumber of domains: ${this.tc.domains}
\tSamples per domain: ${this.tc.samplesPerDomain}
\tNumber of domains: ${formatNumber(this.tc.domains)}
\tSamples per domain: ${formatNumber(this.tc.samplesPerDomain)}
\tAuto commit: ${this.tc.autoCommit}
\tIndex persist interval: ${this.tc.indexPersistInterval}
\tWriter mode: ${framer.WriterMode[this.tc.writerMode]}
Expand Down Expand Up @@ -215,6 +215,10 @@ Expected error: ${this.tc.expectedError}; Actual error: ${actualError}\n${errorA
}
}

function formatNumber(x: number): string {
return x.toFixed(2).toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}

async function main(): Promise<void> {
try {
await new WriteTest(process.argv).testWithTiming()
Expand Down

0 comments on commit e406cf0

Please sign in to comment.