Skip to content
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

Fixed flaky e2e test #355

Merged
merged 1 commit into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions single_tech_samples/streamanalytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
```bash
APP="tech-sample"
ENVIRONMENT="test"
LOCATION="japaneast"
LOCATION="westus"
STORAGE_ACCOUNT="st${APP/-/}${ENVIRONMENT}"
```

Expand All @@ -50,14 +50,15 @@ az deployment group what-if -f main.bicep -g rg-${APP} --parameters query='@./st
# Create Azure Resources. This will also start the job

az deployment group create -f main.bicep -g rg-${APP} --parameters query='@./streamanalytics-tech-sample.asaql' name=${APP} env=${ENVIRONMENT}

# Add device

az iot hub device-identity create --hub-name iot-${APP}-${ENVIRONMENT} --device-id iot-${APP}-${ENVIRONMENT} --edge-enabled
```

## Functional Test

```bash
# Add device

az iot hub device-identity create --hub-name iot-${APP}-${ENVIRONMENT} --device-id iot-${APP}-${ENVIRONMENT} --edge-enabled

# Use connection information with "Raspberry Pi Azure IoT Online Simulator": https://azure-samples.github.io/raspberry-pi-web-simulator/

Expand Down
16 changes: 8 additions & 8 deletions single_tech_samples/streamanalytics/e2e/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BlobItem, ContainerClient } from '@azure/storage-blob';
chai.use(require('chai-subset'));

const EVENT_SINK_CONTAINER = 'bloboutput';
const EXPECTED_E2E_LATENCY_MS = 1000;
const EXPECTED_E2E_LATENCY_MS = 1500;
const DEVICE_ID = 'modern-data-warehouse-dataops/single_tech_samples/streamanalytics/e2e'

describe('Send to IoT Hub', () => {
Expand Down Expand Up @@ -78,8 +78,8 @@ describe('Send to IoT Hub', () => {
});
}

async function delay(factor = 1) {
await new Promise(resolve => setTimeout(resolve, EXPECTED_E2E_LATENCY_MS * factor));
async function delay() {
await new Promise(resolve => setTimeout(resolve, EXPECTED_E2E_LATENCY_MS));
}

describe('payload with temperature', () => {
Expand All @@ -101,7 +101,7 @@ describe('Send to IoT Hub', () => {
const entries = convertBlobData(blobData);
chai.expect(entries).to.have.length(1);
chai.expect(entries).to.containSubset([data]);
});
}).timeout(3000);
});

describe('equal to 27 degrees', () => {
Expand All @@ -114,11 +114,11 @@ describe('Send to IoT Hub', () => {

await send(message);

await delay(1.5);
await delay();

const blob = await getFirstBlob();
chai.expect(blob).to.be.undefined;
});
}).timeout(2000);
});

describe('less than 27 degrees', () => {
Expand All @@ -131,11 +131,11 @@ describe('Send to IoT Hub', () => {

await send(message);

await delay(1.5);
await delay();

const blob = await getFirstBlob();
chai.expect(blob).to.be.undefined;
});
}).timeout(2000);
});
});
});