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

test: fix and improve ci #258

Merged
merged 22 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install nix
uses: cachix/install-nix-action@v22
Expand Down
32 changes: 16 additions & 16 deletions flake.lock

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

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
versions.url = "github:holochain/holochain?dir=versions/0_2";
holonix.url = "github:holochain/holochain";
holonix.inputs.versions.follows = "versions";
holonix.inputs.holochain.url = "github:holochain/holochain/holochain-0.2.2";
holonix.inputs.holochain.url = "github:holochain/holochain/holochain-0.2.3-beta-rc.1";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't build this holochain tag on CI. see here what's used for the 0_2 versions flake

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, thanks for clarifying @steveej

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The simple solution with that one is that we should get 0.2.3 released. Just waiting on holochain/holochain#2951 and we can go ahead with that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

};

outputs = inputs@{ holonix, ... }:
Expand All @@ -16,7 +16,7 @@
perSystem = { config, system, pkgs, ... }:
{
devShells.default = pkgs.mkShell {
inputsFrom = [ holonix.devShells.${system}.holonix ];
inputsFrom = [ holonix.devShells.${system}.holochainBinaries ];
packages = with pkgs; [
# add further packages from nixpkgs
nodejs
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"test": "vitest run"
},
"dependencies": {
"@holochain/client": "^0.16.1",
"@holochain/tryorama": "0.15.0",
"@holochain/client": "^0.16.3",
"@holochain/tryorama": "0.15.1",
"@msgpack/msgpack": "^2.8.0",
"typescript": "^4.9.4",
"vitest": "^0.28.5"
Expand Down
166 changes: 81 additions & 85 deletions tests/src/mewsfeed/agent_pins/pinner-to-hashes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,89 +4,85 @@ import { runScenario, dhtSync } from "@holochain/tryorama";
import { AgentPubKey, HoloHash, fakeActionHash } from "@holochain/client";

test("link a Pinner to a Hash", async () => {
await runScenario(
async (scenario) => {
// Construct proper paths for your app.
// This assumes app bundle created by the `hc app pack` command.
const testAppPath = process.cwd() + "/../workdir/mewsfeed.happ";

// Set up the app to be installed
const appSource = { appBundleSource: { path: testAppPath } };

// Add 2 players with the test app to the Scenario. The returned players
// can be destructured.
const [alice, bob] = await scenario.addPlayersWithApps([
appSource,
appSource,
]);

// Shortcut peer discovery through gossip and register all agents in every
// conductor of the scenario.
await scenario.shareAllAgents();

const baseAddress = alice.agentPubKey;
const targetHash = await fakeActionHash();

// Bob gets the links, should be empty
let linksOutput: HoloHash[] = await bob.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "get_hashes_for_pinner",
payload: baseAddress,
});
assert.equal(linksOutput.length, 0);

// Alice creates a link from Pinner to Hash
await alice.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "pin_hash",
payload: targetHash,
});

await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "get_hashes_for_pinner",
payload: baseAddress,
});

assert.equal(linksOutput.length, 1);

// Bob gets the links in the inverse direction
const pinnersOutput: AgentPubKey[] = await bob.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "get_pinners_for_hash",
payload: targetHash,
});
assert.equal(pinnersOutput.length, 1);

await alice.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "unpin_hash",
payload: targetHash,
});

await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "get_hashes_for_pinner",
payload: baseAddress,
});
assert.equal(linksOutput.length, 0);

// Bob gets the links in the inverse direction
linksOutput = await bob.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "get_pinners_for_hash",
payload: targetHash,
});

assert.equal(linksOutput.length, 0);
},
true,
{ timeout: 500000 }
);
await runScenario(async (scenario) => {
// Construct proper paths for your app.
// This assumes app bundle created by the `hc app pack` command.
const testAppPath = process.cwd() + "/../workdir/mewsfeed.happ";

// Set up the app to be installed
const appSource = { appBundleSource: { path: testAppPath } };

// Add 2 players with the test app to the Scenario. The returned players
// can be destructured.
const [alice, bob] = await scenario.addPlayersWithApps([
appSource,
appSource,
]);

// Shortcut peer discovery through gossip and register all agents in every
// conductor of the scenario.
await scenario.shareAllAgents();

const baseAddress = alice.agentPubKey;
const targetHash = await fakeActionHash();

// Bob gets the links, should be empty
let linksOutput: HoloHash[] = await bob.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "get_hashes_for_pinner",
payload: baseAddress,
});
assert.equal(linksOutput.length, 0);

// Alice creates a link from Pinner to Hash
await alice.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "pin_hash",
payload: targetHash,
});

await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "get_hashes_for_pinner",
payload: baseAddress,
});

assert.equal(linksOutput.length, 1);

// Bob gets the links in the inverse direction
const pinnersOutput: AgentPubKey[] = await bob.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "get_pinners_for_hash",
payload: targetHash,
});
assert.equal(pinnersOutput.length, 1);

await alice.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "unpin_hash",
payload: targetHash,
});

await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "get_hashes_for_pinner",
payload: baseAddress,
});
assert.equal(linksOutput.length, 0);

// Bob gets the links in the inverse direction
linksOutput = await bob.cells[0].callZome({
zome_name: "agent_pins",
fn_name: "get_pinners_for_hash",
payload: targetHash,
});

assert.equal(linksOutput.length, 0);
}, true);
});
Loading
Loading