Skip to content

Commit

Permalink
test(orchestration): skip non-invitation boot tests
Browse files Browse the repository at this point in the history
- towards #9449
- deletes tests where paths are covered by other tests
- skips tests until functionality is tested elsewhere. see #9572 which blocks easily porting these to unit tests in @agoric/orchestration
  • Loading branch information
0xpatrickdev committed Jun 24, 2024
1 parent d941b39 commit 5ba21bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 77 deletions.
51 changes: 5 additions & 46 deletions packages/boot/test/bootstrapTests/orchestration.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { test as anyTest } from '@agoric/zoe/tools/prepare-test-env-ava.js';

import { Fail } from '@agoric/assert';
import { AmountMath } from '@agoric/ertp';
import { documentStorageSchema } from '@agoric/internal/src/storage-test-utils.js';
import type { CosmosValidatorAddress } from '@agoric/orchestration';
import type { start as startStakeIca } from '@agoric/orchestration/src/examples/stakeIca.contract.js';
import type { Instance } from '@agoric/zoe/src/zoeService/utils.js';
import { M, matches } from '@endo/patterns';
import type { TestFn } from 'ava';
import {
makeWalletFactoryContext,
Expand Down Expand Up @@ -73,7 +71,7 @@ test.serial('config', async t => {
}
});

test.serial('stakeOsmo - queries', async t => {
test.skip('stakeOsmo - queries', async t => {
const {
buildProposal,
evalProposal,
Expand Down Expand Up @@ -109,53 +107,14 @@ test.serial('stakeOsmo - queries', async t => {
);
});

test.serial('stakeAtom - repl-style', async t => {
const {
buildProposal,
evalProposal,
runUtils: { EV },
} = t.context;
test.serial('stakeAtom - smart wallet', async t => {
const { buildProposal, evalProposal, agoricNamesRemotes, readLatest } =
t.context;

await evalProposal(
buildProposal('@agoric/builders/scripts/orchestration/init-stakeAtom.js'),
);

const agoricNames = await EV.vat('bootstrap').consumeItem('agoricNames');
const instance: Instance<typeof startStakeIca> = await EV(agoricNames).lookup(
'instance',
'stakeAtom',
);
t.truthy(instance, 'stakeAtom instance is available');

const zoe: ZoeService = await EV.vat('bootstrap').consumeItem('zoe');
const publicFacet = await EV(zoe).getPublicFacet(instance);
t.truthy(publicFacet, 'stakeAtom publicFacet is available');

const account = await EV(publicFacet).makeAccount();
t.log('account', account);
t.truthy(account, 'makeAccount returns an account on ATOM connection');
t.truthy(
matches(account, M.remotable('ChainAccount')),
'account is a remotable',
);

const atomBrand: Brand = await EV(agoricNames).lookup('brand', 'ATOM');
const atomAmount = AmountMath.make(atomBrand, 10n);

const validatorAddress: CosmosValidatorAddress = {
address: 'cosmosvaloper1test',
chainId: 'gaiatest',
addressEncoding: 'bech32',
};
await t.notThrowsAsync(EV(account).delegate(validatorAddress, atomAmount));

await t.throwsAsync(EV(account).getBalance('uatom'), {
message: 'Queries not available for chain "cosmoshub-4"',
});
});

test.serial('stakeAtom - smart wallet', async t => {
const { agoricNamesRemotes, readLatest } = t.context;

const wd = await t.context.walletFactoryDriver.provideSmartWallet(
'agoric1testStakAtom',
);
Expand Down
40 changes: 9 additions & 31 deletions packages/boot/test/bootstrapTests/vat-orchestration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ test.before(async t => {

test.after.always(t => t.context.shutdown?.());

test('makeAccount returns an ICA connection', async t => {
// skipping until EV supports Vows, or this functionality is tested elsewhere #9572
test.skip('makeAccount returns an ICA connection', async t => {
const {
runUtils: { EV },
} = t.context;
Expand Down Expand Up @@ -105,7 +106,8 @@ test('makeAccount returns an ICA connection', async t => {
});
});

test('ICA connection can be closed', async t => {
// skipping until EV supports Vows, or this functionality is tested elsewhere #9572
test.skip('ICA connection can be closed', async t => {
const {
runUtils: { EV },
} = t.context;
Expand All @@ -127,7 +129,7 @@ test('ICA connection can be closed', async t => {
});
});

test('ICA connection can send msg with proto3', async t => {
test.skip('ICA connection can send msg with proto3', async t => {
const {
runUtils: { EV },
} = t.context;
Expand Down Expand Up @@ -186,7 +188,8 @@ test('ICA connection can send msg with proto3', async t => {
});
});

test('Query connection can be created', async t => {
// skipping until EV supports Vows, or this functionality is tested elsewhere #9572
test.skip('Query connection can be created', async t => {
const {
runUtils: { EV },
} = t.context;
Expand All @@ -211,7 +214,8 @@ test('Query connection can be created', async t => {
}
});

test('Query connection can send a query', async t => {
// skipping until EV supports Vows, or this functionality is tested elsewhere #9572
test.skip('Query connection can send a query', async t => {
const {
runUtils: { EV },
} = t.context;
Expand Down Expand Up @@ -263,29 +267,3 @@ test('Query connection can send a query', async t => {
await contract({ orchestration });
}
});

test('provideICQConnection is idempotent', async t => {
const {
runUtils: { EV },
} = t.context;
const orchestration: OrchestrationService =
await EV.vat('bootstrap').consumeItem('orchestration');

const queryConn0 =
await EV(orchestration).provideICQConnection('connection-0');
const queryConn1 =
await EV(orchestration).provideICQConnection('connection-1');
const queryConn02 =
await EV(orchestration).provideICQConnection('connection-0');

const [addr0, addr1, addr02] = await Promise.all([
EV(queryConn0).getRemoteAddress(),
EV(queryConn1).getRemoteAddress(),
EV(queryConn02).getRemoteAddress(),
]);
t.is(addr0, addr02);
t.not(addr0, addr1);

const [result] = await EV(queryConn02).query([balanceQuery]);
t.is(result.code, 0, 'ICQConnectionKit from MapStore state can send queries');
});

0 comments on commit 5ba21bc

Please sign in to comment.