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

FederatedStore in code test for RemoveGraphAndDeleteAllData #2802

Open
GCHQDev404 opened this issue Nov 2, 2022 · 0 comments
Open

FederatedStore in code test for RemoveGraphAndDeleteAllData #2802

GCHQDev404 opened this issue Nov 2, 2022 · 0 comments
Labels
enhancement Improvement to existing functionality/feature federated-store Specific to/touches the federated-store module
Milestone

Comments

@GCHQDev404
Copy link
Contributor

GCHQDev404 commented Nov 2, 2022

Describe the new feature you'd like
ADD A TEST to prove Accumulo table is deleted when RemoveGraphAndDeleteAllData is performed links with gh-2632

Why do you want this feature?
currently this has to be tested manual with the team against a real Accumulo instance. ANY future change to the handlers will required re-manual testing.

Describe alternatives you've considered
see comments of #2799
The last assert fails when it shouldn't RemoveGraphAndDeleteAllData hasn't been used yet only RemoveGraph

FederatedStoreTestUtil.resetForFederatedTests();

//Make a FederatedStore
final FederatedStore federatedStore = new FederatedStore();
federatedStore.initialise(GRAPH_ID_TEST_FEDERATED_STORE, new Schema(), new FederatedStoreProperties());

//Add MiniAccumulo
federatedStore.execute(new AddGraph.Builder()
.graphId(DELETE_ALL_DATA_GRAPH)
.schema(loadSchemaFromJson(SCHEMA_EDGE_BASIC_JSON))
.storeProperties(loadAccumuloStoreProperties(PROPERTIES_ACCUMULO_STORE_PROPERTIES))
.build(), contextBlankUser());

//Make a Local MiniAccumulo with Table collision.
final Store directToMiniAccumulo = MiniAccumuloStore.createStore(DELETE_ALL_DATA_GRAPH, loadSchemaFromJson(SCHEMA_EDGE_BASIC_JSON), loadAccumuloStoreProperties(PROPERTIES_ACCUMULO_STORE_PROPERTIES));

//Local Mini is empty
assertThat(directToMiniAccumulo.execute(new GetAllElements(), contextBlankUser()))
.containsExactly();

//Add Element to FederatedStore
federatedStore.execute(new AddElements.Builder().input(edgeBasic()).build(), contextBlankUser());

//Check the element is Local MiniAccumulo confirming table collision.
assertThat(directToMiniAccumulo.execute(new GetAllElements(), contextBlankUser()))
.containsExactly(edgeBasic());

//Federated RemoveGraph with no Deletion of data or tables
federatedStore.execute(new RemoveGraph.Builder().graphId(DELETE_ALL_DATA_GRAPH).build(), contextBlankUser());

//Confirm Local mini is still working and connected to the table.
assertThatNoException()
.isThrownBy(() -> directToMiniAccumulo.execute(new GetAllElements(), contextBlankUser()));

Additional context
Not easy.

@GCHQDev404 GCHQDev404 added the enhancement Improvement to existing functionality/feature label Nov 2, 2022
@GCHQDev404 GCHQDev404 added the federated-store Specific to/touches the federated-store module label Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing functionality/feature federated-store Specific to/touches the federated-store module
Projects
None yet
Development

No branches or pull requests

1 participant