Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
628464b
A little refactoring
coder11 Feb 14, 2021
8e05474
particle lifecycle (WIP)
coder11 Feb 14, 2021
29a9b33
Further refactoring
coder11 Feb 15, 2021
b6e5449
Fix some tests
coder11 Feb 15, 2021
b3050a0
Middleware based handlers
coder11 Feb 16, 2021
bef853e
use new AquaHandler in both RequestFlow and ParticleProcessor
coder11 Feb 16, 2021
5316a20
Push aqua handlers into ParticleProcessor
coder11 Feb 17, 2021
d6fcb2a
Merge remote-tracking branch 'origin/master' into particle-lifecycle
coder11 Feb 19, 2021
449fa93
Some RequestFlow-related stuff
coder11 Feb 19, 2021
423f6e0
Particle processing inside RequestFlow
coder11 Feb 19, 2021
4292c24
Data injection refactoring
coder11 Feb 19, 2021
a6c5641
more refactoring
coder11 Feb 19, 2021
c9abecc
Cleaning timed out particles
coder11 Feb 20, 2021
2d5cc05
Tests build
coder11 Feb 20, 2021
f337666
Fixes, tests...
coder11 Feb 22, 2021
788b818
It almost works
coder11 Feb 22, 2021
a79800b
Merge branch 'master' into particle-lifecycle
coder11 Feb 25, 2021
7995ac3
event registration + tidying up code
coder11 Feb 25, 2021
28fbc35
trying out new api for fetch request
coder11 Feb 25, 2021
38488b0
threw away old registerCallback
coder11 Feb 25, 2021
459778e
typos
coder11 Feb 26, 2021
495c685
More request flow refactoring
coder11 Feb 27, 2021
46d9933
Fix error handling
coder11 Feb 27, 2021
b979bf7
fix missing test
coder11 Feb 27, 2021
cd8ef24
more tests refactoring
coder11 Feb 27, 2021
7957ead
tests cleaning up
coder11 Feb 27, 2021
b25717f
refactor & fix tests
coder11 Feb 28, 2021
92405e1
more tests fix
coder11 Feb 28, 2021
89e1409
more tests fix contd
coder11 Feb 28, 2021
d102e79
fix test name
coder11 Feb 28, 2021
d9ee887
fix xor error handling
coder11 Feb 28, 2021
20d1ee4
Interpreter as single class export
coder11 Feb 28, 2021
7e83957
rename refactorings
coder11 Feb 28, 2021
3320ddb
rename refactorings contd
coder11 Feb 28, 2021
70d8085
legacy api
coder11 Feb 28, 2021
581c461
Fix particle signature test
coder11 Feb 28, 2021
e3ee051
various test fixes
coder11 Feb 28, 2021
d8313d6
Made particle signature test deterministic
coder11 Mar 1, 2021
f18bc8b
Fix pr comments
coder11 Mar 1, 2021
0d3f3dc
fixed PR comments
coder11 Mar 1, 2021
2f44881
fix PR comments contd.
coder11 Mar 1, 2021
c30209b
add some docs
coder11 Mar 2, 2021
109e194
Fix tests
coder11 Mar 2, 2021
5184de3
documentation
coder11 Mar 2, 2021
37d360d
AquaResult -> AquaCallResult
coder11 Mar 2, 2021
f368e6a
Notes about middlewares
coder11 Mar 2, 2021
97476b1
Change ci cache key
coder11 Mar 2, 2021
61a552d
trying to fix broken tests on CI
coder11 Mar 3, 2021
13109d9
trying to fix broken tests on CI contd/
coder11 Mar 3, 2021
c0a3579
Stopping clients after the tests
coder11 Mar 3, 2021
eb6dfab
Fix particle signing logic
coder11 Mar 3, 2021
5b82b2d
Merge remote-tracking branch 'origin/master' into particle-lifecycle
coder11 Mar 3, 2021
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
6 changes: 3 additions & 3 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"author": "Fluence Labs",
"license": "Apache-2.0",
"dependencies": {
"@fluencelabs/aquamarine-interpreter": "^0.7.0",
"@fluencelabs/aquamarine-interpreter": "0.7.2",
"async": "3.2.0",
"base64-js": "1.3.1",
"bs58": "4.0.1",
Expand Down
35 changes: 0 additions & 35 deletions src/FluenceClient.ts

This file was deleted.

23 changes: 6 additions & 17 deletions src/__test__/connection.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { generatePeerId } from '..';
import { createClient } from '../api';
import { FluenceClientImpl } from '../internal/FluenceClientImpl';

// Uncomment to test on dev nodes
// export const nodes = [
// {
Expand All @@ -14,22 +10,15 @@ import { FluenceClientImpl } from '../internal/FluenceClientImpl';
// },
// ];

// start docker container to run integration tests locally
// > docker run --rm -e RUST_LOG="info" -p 1210:1210 -p 4310:4310 fluencelabs/fluence:freeze -t 1210 -w 4310 -k gKdiCSUr1TFGFEgu2t8Ch1XEUsrN5A2UfBLjSZvfci9SPR3NvZpACfcpPGC3eY4zma1pk7UvYv5zb1VjvPHwCjj
/*
* start docker container to run integration tests locally:

docker run --rm -e RUST_LOG="info" -p 1210:1210 -p 4310:4310 fluencelabs/fluence -t 1210 -w 4310 -k gKdiCSUr1TFGFEgu2t8Ch1XEUsrN5A2UfBLjSZvfci9SPR3NvZpACfcpPGC3eY4zma1pk7UvYv5zb1VjvPHwCjj

*/
export const nodes = [
{
multiaddr: '/ip4/127.0.0.1/tcp/4310/ws/p2p/12D3KooWKEprYXUXqoV5xSBeyqrWLpQLLH4PXfvVkDJtmcqmh5V3',
peerId: '12D3KooWKEprYXUXqoV5xSBeyqrWLpQLLH4PXfvVkDJtmcqmh5V3',
},
];

export const createLocalClient = async () => {
const peerId = await generatePeerId();
const client = new FluenceClientImpl(peerId);
await client.local();
return client;
};

export const createConnectedClient = async (node: string) => {
return (await createClient(node)) as FluenceClientImpl;
};
57 changes: 24 additions & 33 deletions src/__test__/integration/builtins.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,46 @@ import {
uploadModule,
} from '../../internal/builtins';
import { ModuleConfig } from '../../internal/moduleConfig';
import { checkConnection } from '../../api';
import { generatePeerId } from '../..';
import { FluenceClientImpl } from '../../internal/FluenceClientImpl';
import { createConnectedClient, nodes } from '../connection';
import { createClient, FluenceClient } from '../../api.unstable';
import { nodes } from '../connection';

let client: FluenceClient;

describe('Builtins usage suite', () => {
afterEach(async () => {
if (client) {
await client.disconnect();
}
});

jest.setTimeout(10000);

it('get_modules', async function () {
const client = await createConnectedClient(nodes[0].multiaddr);
client = await createClient(nodes[0].multiaddr);

let modulesList = await getModules(client);

expect(modulesList).not.toBeUndefined;
});

it('get_interfaces', async function () {
const client = await createConnectedClient(nodes[0].multiaddr);
client = await createClient(nodes[0].multiaddr);

let interfaces = await getInterfaces(client);

expect(interfaces).not.toBeUndefined;
});

it('get_blueprints', async function () {
const client = await createConnectedClient(nodes[0].multiaddr);
client = await createClient(nodes[0].multiaddr);

let bpList = await getBlueprints(client);

expect(bpList).not.toBeUndefined;
});

it('check_connection', async function () {
const peerId = await generatePeerId();
const client = new FluenceClientImpl(peerId);
await client.local();
await client.connect(nodes[0].multiaddr);

let isConnected = await checkConnection(client);

expect(isConnected).toEqual(true);
});

it('upload_modules', async function () {
const client = await createConnectedClient(nodes[0].multiaddr);

console.log('peerid: ' + client.selfPeerId);
client = await createClient(nodes[0].multiaddr);

let config: ModuleConfig = {
name: 'test_broken_module',
Expand All @@ -75,7 +68,7 @@ describe('Builtins usage suite', () => {
});

it('add_blueprint', async function () {
const client = await createConnectedClient(nodes[0].multiaddr);
client = await createClient(nodes[0].multiaddr);

let bpId = 'some';

Expand All @@ -84,20 +77,19 @@ describe('Builtins usage suite', () => {
expect(bpIdReturned).toEqual(bpId);
});

// FIXME:: there is no error on broken blueprint from a node
it.skip('create_service', async function () {
const client = await createConnectedClient(nodes[0].multiaddr);
it('create broken blueprint', async function () {
client = await createClient(nodes[0].multiaddr);

let serviceId = await createService(client, 'test_broken_blueprint');
let promise = createService(client, 'test_broken_blueprint');

// TODO there is no error on broken blueprint from a node
expect(serviceId).not.toBeUndefined;
await expect(promise).rejects.toMatchObject({
error: expect.stringContaining("Blueprint wasn't found at"),
instruction: expect.stringContaining('blueprint_id'),
});
});

it('add and remove script', async function () {
const client = await createConnectedClient(nodes[0].multiaddr);

console.log('peerid: ' + client.selfPeerId);
client = await createClient(nodes[0].multiaddr);

let script = `
(seq
Expand All @@ -107,7 +99,7 @@ describe('Builtins usage suite', () => {
`;

let resMakingPromise = new Promise((resolve) => {
client.registerCallback('test', 'test1', (args, _) => {
client.aquaCallHandler.on('test', 'test1', (args, _) => {
resolve([...args]);
return {};
});
Expand All @@ -117,7 +109,6 @@ describe('Builtins usage suite', () => {

await resMakingPromise
.then((args) => {
console.log('final!');
expect(args as string[]).toEqual(['1', '2', '3']);
})
.finally(() => {
Expand Down
Loading