Skip to content

Commit

Permalink
Merge pull request #122 from holochain/fix/do-not-stop-conductor-star…
Browse files Browse the repository at this point in the history
…t-on-error

Fix/do not stop conductor start on error
  • Loading branch information
jost-s committed Jun 15, 2022
2 parents f0bc10e + d449300 commit 483380f
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 306 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [0.5.4]

### Changed
- Fix error handling during conductor startup (only log error instead of crashing) [issue \#119](https://github.com/holochain/tryorama/issues/119)
- Update Holochain client (ESM only)

## [0.5.4]

### Added
- Export function to add all agents to all conductors.

Expand Down
2 changes: 1 addition & 1 deletion docs/tryorama.getzomecaller.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Get a shorthand function to call a Cell's Zome.
<b>Signature:</b>

```typescript
getZomeCaller: (cell: CallableCell, zomeName: string) => <T>(fnName: string, payload: unknown) => Promise<T>
getZomeCaller: (cell: CallableCell, zomeName: string) => <T>(fnName: string, payload?: unknown) => Promise<T>
```
387 changes: 102 additions & 285 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@holochain/tryorama",
"description": "Toolset to manage Holochain conductors and facilitate running test scenarios",
"version": "0.5.4",
"version": "0.5.5",
"author": "Holochain Foundation",
"keywords": [
"holochain",
Expand Down Expand Up @@ -45,7 +45,7 @@
"test:trycp:scenario": "node --loader ts-node/esm ts/test/trycp/scenario.ts"
},
"dependencies": {
"@holochain/client": "^0.3.2",
"@holochain/client": "^0.4.1",
"get-port": "^6.1.2",
"lodash": "^4.17.21",
"uuid": "^8.3.2",
Expand Down
2 changes: 1 addition & 1 deletion ts/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const getCallableCell = (
*/
export const getZomeCaller =
(cell: CallableCell, zomeName: string) =>
<T>(fnName: string, payload: unknown): Promise<T> =>
<T>(fnName: string, payload?: unknown): Promise<T> =>
cell.callZome<T>({
zome_name: zomeName,
fn_name: fnName,
Expand Down
19 changes: 9 additions & 10 deletions ts/src/local/conductor.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import assert from "node:assert";
import pick from "lodash/pick.js";
import getPort, { portNumbers } from "get-port";
import { ChildProcessWithoutNullStreams, spawn } from "node:child_process";
import { v4 as uuidv4 } from "uuid";
import {
AdminWebsocket,
AppBundleSource,
Expand All @@ -13,11 +8,16 @@ import {
InstallAppBundleRequest,
InstallAppDnaPayload,
} from "@holochain/client";
import getPort, { portNumbers } from "get-port";
import pick from "lodash/pick.js";
import assert from "node:assert";
import { ChildProcessWithoutNullStreams, spawn } from "node:child_process";
import { URL } from "node:url";
import { v4 as uuidv4 } from "uuid";

import { makeLogger } from "../logger.js";
import { AgentHapp, IConductor, HappBundleOptions } from "../types.js";
import { enableAndGetAgentHapp } from "../common.js";
import { makeLogger } from "../logger.js";
import { AgentHapp, HappBundleOptions, IConductor } from "../types.js";

const logger = makeLogger("Local Conductor");

Expand Down Expand Up @@ -247,7 +247,7 @@ export class Conductor implements IConductor {
// the process doesn't kill the conductor
}
);
const startPromise = new Promise<void>((resolve, reject) => {
const startPromise = new Promise<void>((resolve) => {
runConductorProcess.stdout.on("data", (data: Buffer) => {
logger.debug(`starting conductor\n${data}`);

Expand All @@ -271,8 +271,7 @@ export class Conductor implements IConductor {
});

runConductorProcess.stderr.once("data", (data: Buffer) => {
logger.error(`error when starting conductor: ${data.toString()}`);
reject(data);
logger.error(`starting conductor: ${data.toString()}`);
});
});
await startPromise;
Expand Down
6 changes: 3 additions & 3 deletions ts/src/trycp/conductor/conductor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
DumpFullStateRequest,
DumpStateRequest,
EnableAppRequest,
FullStateDump,
InstallAppBundleRequest,
InstallAppDnaPayload,
InstallAppRequest,
Expand All @@ -23,16 +24,15 @@ import {
StartAppRequest,
UninstallAppRequest,
} from "@holochain/client";
import { FullStateDump } from "@holochain/client/lib/api/state-dump";
import getPort, { portNumbers } from "get-port";
import assert from "node:assert";
import fs from "node:fs";
import getPort, { portNumbers } from "get-port";
import { URL } from "node:url";
import { v4 as uuidv4 } from "uuid";
import { TryCpClient, TryCpConductorLogLevel } from "../index.js";
import { enableAndGetAgentHapp } from "../../common.js";
import { makeLogger } from "../../logger.js";
import { AgentHapp, IConductor } from "../../types.js";
import { TryCpClient, TryCpConductorLogLevel } from "../index.js";
import {
RequestAdminInterfaceData,
RequestCallAppInterfaceMessage,
Expand Down
2 changes: 1 addition & 1 deletion ts/src/trycp/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
DumpStateResponse,
EnableAppRequest,
EnableAppResponse,
FullStateDump,
HoloHash,
InstallAppBundleRequest,
InstallAppBundleResponse,
Expand All @@ -33,7 +34,6 @@ import {
UninstallAppRequest,
UninstallAppResponse,
} from "@holochain/client";
import { FullStateDump } from "@holochain/client/lib/api/state-dump";
import { ConductorId } from "./conductor/index.js";

/**
Expand Down
6 changes: 3 additions & 3 deletions ts/test/local/conductor.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { HeaderHash } from "@holochain/client";
import {
AppSignal,
AppSignalCb,
DnaSource,
EntryHash,
} from "@holochain/client/lib.es/index.js";
} from "@holochain/client";
import { readFileSync } from "node:fs";
import test from "tape-promise/tape.js";
import { URL } from "node:url";
import test from "tape-promise/tape.js";
import {
addAllAgentsToAllConductors,
getZomeCaller,
Expand All @@ -18,7 +19,6 @@ import {
} from "../../src/index.js";
import { pause } from "../../src/util.js";
import { FIXTURE_DNA_URL, FIXTURE_HAPP_URL } from "../fixture/index.js";
import { HeaderHash } from "@holochain/client";

test("Local Conductor - Spawn a conductor with QUIC network", async (t) => {
const conductor = await createConductor({
Expand Down

0 comments on commit 483380f

Please sign in to comment.