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

E2e test troubleshooting #1033

Merged
merged 23 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6787614
build: increase number of providers from 12 to 24
grisha87 Jul 16, 2024
f62a9f2
fix(jobs): fixed the issue with agreements getting terminated before …
grisha87 Jul 16, 2024
8e60711
Revert "build: increase number of providers from 12 to 24"
grisha87 Jul 16, 2024
8c80df7
refactor: added few more result lines to web example cypress test
grisha87 Jul 16, 2024
756323b
Revert "Revert "build: increase number of providers from 12 to 24""
grisha87 Jul 16, 2024
28fadc2
refactor(golem-network): pass GN logger to the underlying storage pro…
grisha87 Jul 16, 2024
e2ab7e9
refactor(examples): switch all examples log level to debug
grisha87 Jul 16, 2024
a02eee7
refactor(market): provide more debug logs related to getting draft pr…
grisha87 Jul 16, 2024
fb34ca7
build: fixup for the change above
grisha87 Jul 16, 2024
66a0243
refactor: removed noisy log line
grisha87 Jul 16, 2024
060912d
build: adjusted GH action for debugging
grisha87 Jul 16, 2024
31fe22b
build: fixup of pipeline
grisha87 Jul 16, 2024
b0a9e12
build: do not show progress during SDK build for tests
grisha87 Jul 16, 2024
124d121
build: fix subnet in market scan done by the pipeline
grisha87 Jul 16, 2024
fa1f5e4
build: fix subnet in market scan done by the pipeline
grisha87 Jul 16, 2024
a8568bf
build: use correct payment network when doing the market scan
grisha87 Jul 16, 2024
74590b5
build: wait for 6 providers
prekucki Jul 16, 2024
fcc3b5f
build: set no-progress for installing @prekucki/wait-for-n
grisha87 Jul 17, 2024
91aab75
Revert "refactor(examples): switch all examples log level to debug"
grisha87 Jul 17, 2024
dcc1439
Merge remote-tracking branch 'origin/beta' into e2e-test-troubleshooting
grisha87 Jul 17, 2024
3d2ba04
chore(deps): updated @golem-sdk/pino-logger lib to latest version
grisha87 Jul 17, 2024
5479ae9
test: fixed failing unit test
grisha87 Jul 17, 2024
f399bca
refactor: test cleanup
grisha87 Jul 17, 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
17 changes: 16 additions & 1 deletion .github/actions/prepare-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,26 @@ runs:
shell: bash
run: |
echo "Going to build the SDK on the requestor"
docker exec -t docker-requestor-1 /bin/sh -c "cd /golem-js && npm i && npm run build"
docker exec -t docker-requestor-1 /bin/sh -c "cd /golem-js && npm i --no-progress && npm run build"
echo "Successfully built the SDK on the requestor"

- name: Install Cypress
if: ${{ inputs.type == 'cypress' }}
shell: bash
run: |
docker exec -t docker-requestor-1 /bin/sh -c "cd /golem-js && ./node_modules/.bin/cypress install"

- name: Run a preliminary scan of offers
shell: bash
run: |
docker exec -t docker-requestor-1 /bin/sh -c "npm install --no-progress -g @prekucki/wait-for-n && wait-for-n --limit=6 --appkey=try_golem --subnet=$YAGNA_SUBNET"

- name: List down sessions seen on that requestor
shell: bash
run: |
docker exec docker-requestor-1 /bin/sh -c "yagna net sessions"

- name: Run a secondary scan of offers
shell: bash
run: |
docker exec -t docker-requestor-1 /bin/sh -c "npx --no-progress --yes @golem-sdk/cli market scan -k try_golem --subnet-tag $YAGNA_SUBNET --payment-network $PAYMENT_NETWORK"
2 changes: 2 additions & 0 deletions examples/web/hello.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ <h3>Results</h3>
await glm.connect();
appendResults("Request for renting a provider machine");
const rental = await glm.oneOf({ order });
appendResults("Rented resources from", rental.agreement.provider.name);
await rental
.getExeUnit()
.then(async (exe) =>
appendResults("Reply: " + (await exe.run(`echo 'Hello Golem! 👋 from ${exe.provider.name}!'`)).stdout),
);
appendResults("Finished all work with the resources");
await rental.stopAndFinalize();
appendResults("Finalized renting process");
} catch (err) {
Expand Down
14 changes: 8 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"node": ">=18.0.0"
},
"dependencies": {
"@golem-sdk/pino-logger": "^1.1.0",
"async-lock": "^1.4.1",
"async-retry": "^1.3.3",
"axios": "^1.6.7",
Expand All @@ -84,7 +85,7 @@
"devDependencies": {
"@commitlint/cli": "^19.0.3",
"@commitlint/config-conventional": "^19.0.3",
"@johanblumenberg/ts-mockito": "^1.0.41",
"@johanblumenberg/ts-mockito": "^1.0.43",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
Expand Down
6 changes: 4 additions & 2 deletions src/golem-network/golem-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,12 @@ export class GolemNetwork {
if (typeof this.options.dataTransferProtocol === "string") {
switch (this.options.dataTransferProtocol) {
case "ws":
return new WebSocketBrowserStorageProvider(this.yagna, {});
return new WebSocketBrowserStorageProvider(this.yagna, {
logger: this.logger,
});
case "gftp":
default:
return new GftpStorageProvider();
return new GftpStorageProvider(this.logger);
}
} else if (this.options.dataTransferProtocol !== undefined) {
return this.options.dataTransferProtocol;
Expand Down
15 changes: 6 additions & 9 deletions src/market/market.module.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ describe("Market module", () => {
const badProposal0 = {} as OfferProposal;
const badProposal1 = {} as OfferProposal;
const goodProposal = {} as OfferProposal;

const mockPool = mock(DraftOfferProposalPool);
when(mockPool.acquire(_)).thenResolve(badProposal0).thenResolve(badProposal1).thenResolve(goodProposal);
const goodAgreement = {} as Agreement;
Expand Down Expand Up @@ -497,15 +498,11 @@ describe("Market module", () => {
);
});
it("respects the timeout on draft proposal pool acquire and forwards the error", async () => {
const mockAcquire: DraftOfferProposalPool["acquire"] = jest
.fn()
.mockImplementation(
() => new Promise((_, reject) => setTimeout(() => reject(new Error("Failed to acquire")), 10)),
);
const mockPool = {
acquire: mockAcquire,
} as DraftOfferProposalPool;
expect(marketModule.signAgreementFromPool(mockPool)).rejects.toThrow("Failed to acquire");
const mockPool = mock(DraftOfferProposalPool);
when(mockPool.acquire(_)).thenCall(
() => new Promise((_, reject) => setTimeout(() => reject(new Error("Failed to acquire")), 10)),
);
expect(marketModule.signAgreementFromPool(instance(mockPool))).rejects.toThrow("Failed to acquire");
});
});

Expand Down
10 changes: 8 additions & 2 deletions src/market/market.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,20 @@ export class MarketModuleImpl implements MarketModule {
agreementOptions?: AgreementOptions,
signalOrTimeout?: number | AbortSignal,
): Promise<Agreement> {
this.logger.info("Trying to sign an agreement ...");
this.logger.info("Trying to sign an agreement...");
const signal = createAbortSignalFromTimeout(signalOrTimeout);

const getProposal = async () => {
try {
signal.throwIfAborted();
this.logger.debug("Acquiring proposal from draft proposal pool", {
draftPoolCounters: {
total: draftProposalPool.count(),
available: draftProposalPool.availableCount(),
},
});
const proposal = await draftProposalPool.acquire(signal);
this.logger.debug("Acquired proposal from the pool", { proposal });
if (signal.aborted) {
draftProposalPool.release(proposal);
signal.throwIfAborted();
Expand Down Expand Up @@ -597,7 +604,6 @@ export class MarketModuleImpl implements MarketModule {
if (isCancelled) {
return;
}
this.logger.debug("Waiting for reduced proposals...");
try {
await proposalsBatch.waitForProposals();
const proposals = await proposalsBatch.getProposals();
Expand Down
13 changes: 9 additions & 4 deletions tests/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ services:
retries: 1
start_period: 40s
environment:
- YA_NET_BROADCAST_SIZE=30
- YA_NET_BROADCAST_SIZE=10
- NODE_NAME=provider-1
- SUBNET=${YAGNA_SUBNET:-golemjstest}
- YA_NET_BIND_URL=udp://0.0.0.0:0
- YA_NET_RELAY_HOST=63.34.24.27:7477
provider-2:
build:
context: .
Expand All @@ -43,9 +45,11 @@ services:
retries: 1
start_period: 40s
environment:
- YA_NET_BROADCAST_SIZE=30
- YA_NET_BROADCAST_SIZE=10
- NODE_NAME=provider-2
- SUBNET=${YAGNA_SUBNET:-golemjstest}
- YA_NET_BIND_URL=udp://0.0.0.0:0
- YA_NET_RELAY_HOST=63.34.24.27:7477
requestor:
build:
context: .
Expand All @@ -57,14 +61,15 @@ services:
- /root/.local/share/yagna/
- ../../:/golem-js
environment:
- YA_NET_BROADCAST_SIZE=30
- YA_NET_BROADCAST_SIZE=10
- YAGNA_AUTOCONF_APPKEY=try_golem
- YAGNA_API_URL=http://0.0.0.0:7465
- GSB_URL=tcp://0.0.0.0:7464
- YAGNA_SUBNET=${YAGNA_SUBNET:-golemjstest}
- YAGNA_APPKEY=try_golem
- PAYMENT_NETWORK=${PAYMENT_NETWORK}

- YA_NET_BIND_URL=udp://0.0.0.0:0
- YA_NET_RELAY_HOST=63.34.24.27:7477
healthcheck:
test: ["CMD-SHELL", "curl -s -o /dev/null -w '%{http_code}' http://localhost:7465 | grep -q 401"]
interval: 10s
Expand Down