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

(ts) Runtime de-globalling (step 3) #6758

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3afe810
modernize dev-shell
Nov 6, 2020
a908f48
tweaks
Nov 6, 2020
a093036
law of Demeter
Nov 6, 2020
193c1a7
remove storageService
Nov 12, 2020
4dad548
cleanups
Nov 12, 2020
09fd6b6
surgically remove static (global) runtime object
Nov 17, 2020
32e20ae
clean ups
Nov 18, 2020
1987f50
big runtime usage refactor
Nov 20, 2020
16a0961
cleanups
Nov 20, 2020
ab675d4
cleanups
Nov 20, 2020
328ac92
serious degloballing
Nov 26, 2020
4978ea0
repairs after unpleasant rebase
Dec 8, 2020
1900fe2
remove debugger statement
Dec 8, 2020
00505f1
sleuthing test failures
Dec 8, 2020
6a9f14d
Don't call idle immediately after closing StorageEndpoint
jblebrun Dec 8, 2020
9482eef
Refactors several classes to use injected StorageKeyManager instances…
csilvestrini Dec 8, 2020
7f2ea17
rename EntitySpecTest.kt to javatests/arcs/sdk/GeneratedEntityTest.kt
galganif Dec 8, 2020
7f5e9f6
Fix typo
csilvestrini Dec 8, 2020
2aff690
Tests for BaseHandle.kt
Dec 8, 2020
bdfdce5
Add missing strict deps for type aliases.
arcs-c3po Dec 8, 2020
b4bb177
rename ReferenceSpecTest.kt to javatests/arcs/sdk/GeneratedReferenceT…
galganif Dec 8, 2020
7ebf1f0
add support for inline schema field inside ordered list in fromLitera…
mariakleiner Dec 8, 2020
b81fbd2
Rename EntityHandleManager to HandleManagerImpl to reflect the actual…
yuangu-google Dec 8, 2020
d5242e8
Add more unit tests for DirectStore.
yuangu-google Dec 8, 2020
f1092db
Caching RawEntity hashCode to improve overhead.
alxmrs Dec 9, 2020
408388c
Add error message for CollectionHandle init (#6690)
SHeimlich Dec 9, 2020
0557c0b
Refactor mock helper methods from the Handle tests into testutil/
Dec 9, 2020
be944aa
Remove unused methods from EntityHandleManager and StorageProxy.
Dec 9, 2020
0e2bf53
Create showcase & showcase test for queries
Dec 9, 2020
c9f4166
Disable import ordering in ktlint (#6749)
csilvestrini Dec 10, 2020
75c791e
remove dead code
Dec 10, 2020
4b6bc47
Merge branch 'master' of github.com:PolymerLabs/arcs into dec-dev-she…
Dec 10, 2020
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
Prev Previous commit
Next Next commit
sleuthing test failures
  • Loading branch information
Scott J. Miles committed Dec 8, 2020
commit 00505f153206f20f245b2b351a4319aa7ac53df5
2 changes: 1 addition & 1 deletion shells/tests/arcs/ts/runtime/plan-consumer-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function storeResults(consumer: PlanConsumer, suggestions: Suggestion[]) {
await new Promise(resolve => setTimeout(resolve, 100));
}

describe('planFOOB consumer', () => {
describe('plan consumer', () => {
it('consumes', async () => {
const manifestText = `
import './shells/tests/artifacts/Products/Products.recipes'
Expand Down
11 changes: 8 additions & 3 deletions src/runtime/storage/drivers/driver-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ export interface StorageDriverProvider {
let staticDriverFactory;

export class DriverFactory {
static register({driverFactory}, storageDriverProvider: StorageDriverProvider) {
driverFactory.register(storageDriverProvider);
}
//name;
providers: Set<StorageDriverProvider> = new Set();
constructor() {
staticDriverFactory = this;
//this.name = Math.floor(Math.random()*90) + 10;
//console.warn('DriverFactory constructed: ', this.name);
}
register(storageDriverProvider: StorageDriverProvider) {
//console.warn(`DriverFactory(${this.name}).register`); //, storageDriverProvider);
this.providers.add(storageDriverProvider);
}
unregister(storageDriverProvider: StorageDriverProvider) {
Expand All @@ -49,6 +50,10 @@ export class DriverFactory {
}
return null;
}
// statics
static register({driverFactory}, storageDriverProvider: StorageDriverProvider) {
driverFactory.register(storageDriverProvider);
}
static async driverInstance<Data>(storageKey: StorageKey, exists: Exists) {
return staticDriverFactory.driverInstance(storageKey, exists);
}
Expand Down
1 change: 0 additions & 1 deletion src/runtime/storage/drivers/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ export class FirebaseDriver<Data> extends Driver<Data> {
}
}


export class FirebaseStorageDriverProvider implements StorageDriverProvider {
protected readonly cacheService: RuntimeCacheService;

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/storage/testing/mock-firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ export class MockFirebaseStorageDriverProvider extends FirebaseStorageDriverProv
//DriverFactory.register(new MockFirebaseStorageDriverProvider(cacheService));
//StorageKeyParser.addParser(FirebaseStorageKey.protocol, FirebaseStorageKey.fromString);
//const {projectId, domain, apiKey} = mockFirebaseStorageKeyOptions;
driverFactory.register(new FirebaseStorageDriverProvider(cacheService));
storageKeyParser.addParser(FirebaseStorageKey.protocol, FirebaseStorageKey.fromString);
driverFactory.register(new MockFirebaseStorageDriverProvider(cacheService));
storageKeyParser.addParser(MockFirebaseStorageKey.protocol, MockFirebaseStorageKey.fromString);
}

static getValueForTesting(cacheService: RuntimeCacheService, storageKey: MockFirebaseStorageKey) {
Expand Down
5 changes: 2 additions & 3 deletions src/runtime/storage/tests/firebase-store-integration-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ async function createStore(storageKey: StorageKey, exists: Exists): Promise<Acti
return store as ActiveStore<CRDTCountTypeRecord>;
}

describe('Firebase + Store Integration', async () => {
describe('Firebase + Store Integration', async function() {
let runtime;
beforeEach(() => {
runtime = new Runtime();
MockFirebaseStorageDriverProvider.register(runtime, runtime.getCacheService());
});

it('FLOOB will store a sequence of model and operation updates as models', async () => {
debugger;
it('will store a sequence of model and operation updates as models', async () => {
const storageKey = new MockFirebaseStorageKey('location');
const activeStore = await createStore(storageKey, Exists.ShouldCreate);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,21 @@ describe('ReferenceModeStore Integration', async () => {

it('will store and retrieve entities through referenceModeStores (separate stores)', async () => {
const storageKey = new ReferenceModeStorageKey(new RamDiskStorageKey('backing'), new RamDiskStorageKey('container'));

const type = new EntityType(new Schema(['AnEntity'], {foo: 'Text'})).collectionOf();

// Use newHandle here rather than setting up a store inside the arc, as this ensures writeHandle and readHandle
// are on top of different storage stacks.
const writeHandle = await newHandle(new StoreInfo({storageKey, type, id: 'write-handle'}),
new Runtime().newArc('testWritesArc'));
const readHandle = await newHandle(new StoreInfo({storageKey, type, id: 'read-handle'}),
new Runtime().newArc('testReadArc'));
const writeInfo = new StoreInfo({storageKey, type, id: 'write-handle'});
const writeHandle = await newHandle(writeInfo, new Runtime().newArc('testWritesArc'));

const readInfo = new StoreInfo({storageKey, type, id: 'read-handle'});
const readHandle = await newHandle(readInfo, new Runtime().newArc('testReadArc'));

readHandle.particle = new Particle();
const returnPromise = new Promise((resolve, reject) => {

let state = 0;

readHandle.particle['onHandleSync'] = async (handle, model) => {
console.warn('onHandleSync', model);
if (state === 0) {
assert.deepEqual(model, []);
state = 1;
Expand All @@ -50,9 +49,10 @@ describe('ReferenceModeStore Integration', async () => {
resolve();
}
};

});

console.warn('writeHandle.addFromData');
//debugger;
await writeHandle.addFromData({foo: 'This is text in foo'});
return returnPromise;
});
Expand Down
6 changes: 4 additions & 2 deletions src/runtime/tests/arc-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async function setup(storageKeyPrefix: (arcId: ArcId) => StorageKey) {
}

describe('Arc new storage', () => {
it('preserves data when round-tripping through serialization', async () => {
it('FLOOB preserves data when round-tripping through serialization', async () => {
// TODO(shans): deserialization currently uses a RamDisk store to deserialize into because we don't differentiate
// between parsing a manifest for public consumption (e.g. with RamDisk resources in it) and parsing a serialized
// arc (with an @activeRecipe). We'll fix this by adding a 'private' keyword to store serializations which will
Expand Down Expand Up @@ -130,15 +130,17 @@ describe('Arc new storage', () => {
await arc.instantiate(recipe);

const serialization = await arc.serialize();
console.log(serialization);
console.warn(serialization);
arc.dispose();

await varHandle.clear();
await colHandle.clear();
await refVarHandle.clear();

const {context, storageManager, driverFactory} = opts;
debugger;
const arc2 = await Arc.deserialize({fileName: '', serialization, loader, context, storageManager, driverFactory});
debugger;
const varStore2 = arc2.findStoreById(varStore.id) as StoreInfo<SingletonEntityType>;
const colStore2 = arc2.findStoreById(colStore.id) as StoreInfo<CollectionEntityType>;
const refVarStore2 = arc2.findStoreById(refVarStore.id) as StoreInfo<SingletonEntityType>;
Expand Down
1 change: 1 addition & 0 deletions tools/sigh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const buildShells = () => globalOptions.bazel ? true : buildPkg('shells');
const steps: {[index: string]: ((args?: string[]) => boolean|Promise<boolean>)[]} = {
peg: [peg, railroad],
test: [peg, build, buildShells, runTestsOrHealthOnCron],
justTest: [runTestsOrHealthOnCron],
testShells: [peg, build, buildShells, webpack, webpackStorage, devServerAsync, testWdioShells],
testWdioShells: [testWdioShells],
webpack: [peg, build, buildShells, webpack],
Expand Down