Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
69d2057
Enable yarn:build on mac
leVermito Mar 14, 2023
f30c2e6
Shorten /events/:name endpoint response
piotrek6641 Nov 13, 2023
c987df0
linting changes
piotrek6641 Nov 14, 2023
4a40a9d
fix handler function
piotrek6641 Nov 15, 2023
2b886cc
Remove support for get seq by name
piotrek6641 Nov 21, 2023
fd8eec3
remove support for x-name headers
piotrek6641 Nov 21, 2023
c12ba5e
Merge branch 'devel' into feat/events-stream-format
piotrek6641 Nov 27, 2023
5258bd0
fix switching to active profile
karoltylenda Nov 27, 2023
385c89b
Align data format in /once|event/:name
patuwwy Nov 27, 2023
ee301d3
Merge pull request #998 from scramjetorg/main
alicja-gruzdz Nov 27, 2023
6e9b5b1
Merge pull request #987 from scramjetorg/feat/events-stream-format
patuwwy Nov 27, 2023
49e7980
Update host-steps.ts
karoltylenda Nov 28, 2023
25c415b
Linter fixes
Nov 28, 2023
158a128
Apply suggestions from code review
patuwwy Nov 28, 2023
6a1d6e0
Merge pull request #996 from scramjetorg/test/fix/checkout-profile
patuwwy Nov 28, 2023
ea56f63
add monitoring server config class
piotrek6641 Nov 22, 2023
270d5bb
add missing dependency
piotrek6641 Nov 22, 2023
5029ce0
validate monitoring server config
piotrek6641 Nov 27, 2023
b37a5c1
Apply suggestions from code review
patuwwy Nov 28, 2023
222bdd6
Merge pull request #994 from scramjetorg/feat/monitoring-server-config
patuwwy Nov 28, 2023
3e93f53
remove update by name, send named from Cli
piotrek6641 Nov 29, 2023
7f8d83c
fix cli update seq routing
piotrek6641 Nov 29, 2023
d132266
remove unused parameter from host-client (update)
piotrek6641 Nov 29, 2023
97a3912
improve validation on update/delete seq in host
piotrek6641 Nov 29, 2023
56e9a8d
Immediately send loadCheck to cmp when available
patuwwy Dec 1, 2023
c7bafc4
Merge pull request #1001 from scramjetorg/fix/faster-health
patuwwy Dec 1, 2023
0db672e
Update topic state when topic is deleted
patuwwy Dec 7, 2023
24be0a6
Merge pull request #1004 from scramjetorg/fix/topic-del-update-state
patuwwy Dec 8, 2023
b930b3d
Merge pull request #993 from scramjetorg/refactor/host-seq-api-methods
patuwwy Dec 8, 2023
2da5b33
Faster eslint operation
MichalCz Dec 15, 2023
6c512aa
Fix yarn.lock
MichalCz Dec 15, 2023
9b63200
Fix eslint error from old node
MichalCz Dec 14, 2023
5b9fa2c
Fix stupid error where -v means version, not verbose
MichalCz Dec 15, 2023
3e15b28
Fix run-script so that strict is no longer needed
MichalCz Dec 15, 2023
8d7cba2
Merge pull request #1007 from scramjetorg/fix/fast-eslint
alicja-gruzdz Dec 15, 2023
5281275
Revoke all keys with one request
patuwwy Dec 19, 2023
cfd408d
Merge pull request #1008 from scramjetorg/feat/revoke-all
a-tylenda Dec 19, 2023
3ff4239
autocomplete for files and directories
Nov 30, 2023
2740e34
cli linter fixes
Dec 4, 2023
adfa425
Bump follow-redirects from 1.15.2 to 1.15.4
dependabot[bot] Jan 10, 2024
bb7d214
The command for downloading refapps adjusted to MacOS
alicja-gruzdz Jan 10, 2024
00b3938
Merge pull request #827 from scramjetorg/feat/sth-on-mac
alicja-gruzdz Jan 10, 2024
a2ae463
Merge pull request #1013 from scramjetorg/dependabot/npm_and_yarn/fol…
alicja-gruzdz Jan 10, 2024
bd3efe0
Merge pull request #1000 from scramjetorg/fix/cli_autocomplete
alicja-gruzdz Jan 10, 2024
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
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ There are several installations you need to perform to get STH up and running, a
- ts-node
- docker
- pip
- wget
- jq

Our hub is based on node.js, so you need to install node.js and npm, which is the default package manager for node.js.
To check if you already have Node.js(v16.xx.x) and npm installed, run the following commands in your console:
Expand All @@ -175,7 +177,7 @@ npm -v

If none of the above commands is found, **you must proceed with the installation.**

It is recommended to use a **Node version manager** like [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md) to install Node.js and npm. Do it by running the install script using either of the commands bellow.
It is recommended to use a **Node version manager** like [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md) to install Node.js and npm. Do it by running the install script using either of the commands bellow.
> Note: Make sure you replace v0.39.0 with the latest version of nvm. The actual version of nvm to install is [here](https://github.com/nvm-sh/nvm/blob/master/README.md#install--update-script).

```bash
Expand Down Expand Up @@ -221,7 +223,7 @@ $ npm -v
8.15.0
```

**OK!** It looks like you have successfully installed node.js and npm.
**OK!** It looks like you have successfully installed node.js and npm.

There are two more installations you need to perform, run the following commands in your console one after another:

Expand Down Expand Up @@ -249,10 +251,22 @@ pip --version

If they are not present, refer to the official installation guide for [Python](https://wiki.python.org/moin/BeginnersGuide/Download) and [Pip](https://pip.pypa.io/en/stable/installation/).

Additionally you have to have `wget` and `jq` installed:

```bash
# Debian based distributions:
apt install wget jq

# Mac
brew install wget jq
```

> **If you don't want to use Docker, please skip this step!**

We also work with Docker, but this is optional. Running STH is possible without Docker in the background. If you want to use Docker, you can install it by running the following commands in your console:

*On Mac u can use [Docker-Desktop](https://www.docker.com/products/docker-desktop/)*

```bash
# Install docker and docker-compose
sudo apt install -y docker.io docker-compose
Expand Down Expand Up @@ -302,7 +316,7 @@ In the meantime let me describe for you what is happening in the command you hav

When both the package installation and build are complete, STH should be ready to run.



---

Expand Down Expand Up @@ -499,7 +513,7 @@ We use our own scripts to control our monorepo. Here's a couple of helpful comma
```bash
./scripts/run-script.js [script]
# Run an npm script in each package that contains that script.
./scripts/run-script.js --scope @scramjet/<package_name> <script-name>
./scripts/run-script.js --scope @scramjet/<package_name> <script-name>
# Run script only in one package
./scripts/run-script.js --workspace packages <script-name>
# Run script in all packages in workspace
Expand Down
4 changes: 2 additions & 2 deletions bdd/features/e2e/E2E-010-cli.feature
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ Feature: CLI tests
When I execute CLI with "seq deploy ../packages/event-sequence-v2.tar.gz"
When I execute CLI with "inst event emit - test-event test message"
When I execute CLI with "inst event on - test-event-response"
Then I get event "test-event-response" with event message "{\"eventName\":\"test-event-response\",\"message\":\"message from sequence\"}" from Instance
Then I get event "test-event-response" with event message "\"message from sequence\"" from Instance

@ci-api @cli
Scenario: E2E-010 TC-013a Test Instance 'event' option without payload
When I execute CLI with "seq deploy ../packages/event-sequence-v2.tar.gz"
When I execute CLI with "inst event emit - test-event"
When I execute CLI with "inst event on - test-event-response"
Then I get event "test-event-response" with event message "{\"eventName\":\"test-event-response\",\"message\":\"message from sequence\"}" from Instance
Then I get event "test-event-response" with event message "\"message from sequence\"" from Instance

@ci-api @cli
Scenario: E2E-010 TC-014 Test Sequence 'start' with multiple JSON arguments
Expand Down
4 changes: 2 additions & 2 deletions bdd/features/e2e/E2E-012-stream-flooding-test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: Stream flooding tests. Ensure that even if a large amount of data is se
And wait for "3000" ms
And send event "test-event" to instance with message "test message"
Then get event "test-event-response" from instance
Then instance response body is "{\"eventName\":\"test-event-response\",\"message\":\"message from sequence\"}"
Then instance response body is "\"message from sequence\""
Then host is still running

@ci-api @runner-cleanup
Expand All @@ -23,6 +23,6 @@ Feature: Stream flooding tests. Ensure that even if a large amount of data is se
And get runner PID
Then get event "test-event-response" from instance
When wait for "1000" ms
Then instance response body is "{\"eventName\":\"test-event-response\",\"message\":\"message from sequence\"}"
Then instance response body is "\"message from sequence\""
Then host is still running

2 changes: 1 addition & 1 deletion bdd/features/e2e/E2E-015-unified.feature
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ Feature: Test our shiny new Python runner
And send event "test-event" to instance with message "foo"
Then instance emits event "test-response" with body
"""
{"eventName":"test-response","message":"reply to foo"}
"reply to foo"
"""
And host is still running
17 changes: 17 additions & 0 deletions bdd/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,23 @@ export async function killProcessByName(processName: string): Promise<void> {
});
}

export async function getActiveProfile() {
try {
const res = await getStreamsFromSpawn("/usr/bin/env", [...si, "config", "profile", "ls"]);

const match = res[1].match(/->\s*([^\n]+)/);
const activeProfile = match ? match[1].trim() : null;

if (isLogActive) {
logger.log("Active profile:", activeProfile);
}
return activeProfile;
} catch (error: any) {
logger.error(`Error while getting the active profile: ${error.message}`);
return "";
}
}

export async function createProfile(profileName: string) {
const res = await getStreamsFromSpawn("/usr/bin/env", [...si, "config", "profile", "create", profileName]);

Expand Down
17 changes: 11 additions & 6 deletions bdd/step-definitions/e2e/host-steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
createProfile,
setProfile,
createDirectory,
deleteDirectory
deleteDirectory,
getActiveProfile
} from "../../lib/utils";
import fs, { createReadStream, existsSync, ReadStream } from "fs";
import { HostClient, InstanceOutputStream } from "@scramjet/api-client";
Expand All @@ -37,6 +38,7 @@ let actualLogResponse: any;
let containerId: string;
let processId: number;
let streams: { [key: string]: Promise<string | undefined> } = {};
let activeProfile: any;

const freeport = promisify(require("freeport"));

Expand Down Expand Up @@ -116,13 +118,12 @@ const killRunner = async () => {
}
};

BeforeAll({ timeout: 10e3 }, async () => {
BeforeAll({ timeout: 20e3 }, async () => {
if (process.env.NO_HOST) {
return;
}

await createProfile(profileName);
await setProfile(profileName);
activeProfile = await getActiveProfile();

let apiUrl = process.env.SCRAMJET_HOST_BASE_URL;

Expand Down Expand Up @@ -158,6 +159,8 @@ BeforeAll({ timeout: 10e3 }, async () => {
});
}
await hostUtils.spawnHost([]);
await createProfile(profileName);
await setProfile(profileName);
});

AfterAll(async () => {
Expand All @@ -168,7 +171,7 @@ AfterAll(async () => {
throw new Error("Host unexpected closed");
}
}

await setProfile(activeProfile);
await removeProfile(profileName);
});

Expand All @@ -184,6 +187,7 @@ After({ tags: "@runner-cleanup" }, killRunner);
Before({ tags: "@test-si-init" }, function() {
createDirectory("data/template_seq");
});

After({ tags: "@test-si-init" }, function() {
deleteDirectory("data/template_seq");
});
Expand Down Expand Up @@ -226,6 +230,7 @@ const startHost = async () => {
};

Given("start host", () => startHost());

Then("stop host", () => hostUtils.stopHost());

Then("send fake stream as sequence", async function(this: CustomWorld) {
Expand Down Expand Up @@ -692,7 +697,7 @@ When("confirm that sequence and volumes are removed", async function(this: Custo

if (!sequenceId) assert.fail();

const sequences = (await hostClient.listSequences()) || [];
const sequences = await hostClient.listSequences() || [];
const sequenceExist = !!sequences.find((sequenceInfo) => sequenceId === sequenceInfo.id);

assert.equal(sequenceExist, false);
Expand Down
Loading