Skip to content

Commit

Permalink
End-to-end publishEntry tests (#167)
Browse files Browse the repository at this point in the history
* Use fixture for publish_entry_request

* Post gql publishEntry mutation

* Make the test work

* Add test for errors

* WIP: Failing publish_entry requests

* More failure cases

* Test for publishing many entries

* Add toto

* Update CHANGELOG

* Remove tests which panic before starting

* Change p2panda branch

* Update tests to catch new return errors

* Tests for not spec compliant entries

* fmt

* Back to p2panda-rs main

* p2panda-rs updates

* Link to related issue
  • Loading branch information
sandreae committed Jun 23, 2022
1 parent a4acac6 commit 5a1a845
Show file tree
Hide file tree
Showing 7 changed files with 437 additions and 32 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Reduce and dependency tasks [#144](https://github.com/p2panda/aquadoggo/pull/144)
- GraphQL endpoints for replication [#100](https://github.com/p2panda/aquadoggo/pull/100)
- Inform materialization service about new operations [#161](https://github.com/p2panda/aquadoggo/pull/161)
- e2e publish entry tests [#167](https://github.com/p2panda/aquadoggo/pull/167)
- Reschedule pending tasks on startup [#168](https://github.com/p2panda/aquadoggo/pull/168)

### Changed
Expand All @@ -46,7 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.2.0]

*Please note: `aquadoggo-rs` crate is not published yet, due to unpublished dependencies.*
_Please note: `aquadoggo-rs` crate is not published yet, due to unpublished dependencies._

### Changed

Expand Down Expand Up @@ -79,6 +80,6 @@ Released on 2021-10-25: :package: [`crate`](https://crates.io/crates/aquadoggo/0
- Use p2panda-rs 0.2.1 with fixed linter setting [#41](https://github.com/p2panda/aquadoggo/41)
- Use `tide` for HTTP server and `jsonrpc-v2` for JSON RPC [#29](https://github.com/p2panda/aquadoggo/29)

[Unreleased]: https://github.com/p2panda/aquadoggo/compare/v0.2.0...HEAD
[unreleased]: https://github.com/p2panda/aquadoggo/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/p2panda/aquadoggo/releases/tag/v0.2.0
[0.1.0]: https://github.com/p2panda/aquadoggo/releases/tag/v0.1.0
3 changes: 2 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion aquadoggo/src/db/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use async_trait::async_trait;
use p2panda_rs::document::DocumentId;
use p2panda_rs::hash::Hash;
use p2panda_rs::operation::VerifiedOperation;
use p2panda_rs::storage_provider::traits::StorageProvider;
use sqlx::query_scalar;

Expand All @@ -29,7 +30,7 @@ impl SqlStorage {
/// A `StorageProvider` implementation based on `sqlx` that supports SQLite and PostgreSQL
/// databases.
#[async_trait]
impl StorageProvider<StorageEntry, StorageLog> for SqlStorage {
impl StorageProvider<StorageEntry, StorageLog, VerifiedOperation> for SqlStorage {
type EntryArgsResponse = EntryArgsResponse;
type EntryArgsRequest = EntryArgsRequest;
type PublishEntryResponse = PublishEntryResponse;
Expand Down
4 changes: 2 additions & 2 deletions aquadoggo/src/db/stores/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl SchemaStore for SqlStorage {
schema_fields.push(scheme_field_view);
}

let schema = Schema::new(schema_view, schema_fields)?;
let schema = Schema::from_views(schema_view, schema_fields)?;

Ok(Some(schema))
}
Expand Down Expand Up @@ -87,7 +87,7 @@ impl SchemaStore for SqlStorage {
.map(|field| field.to_owned())
.collect();

all_schema.push(Schema::new(schema_view, schema_fields)?);
all_schema.push(Schema::from_views(schema_view, schema_fields)?);
}

Ok(all_schema)
Expand Down
4 changes: 2 additions & 2 deletions aquadoggo/src/db/stores/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use p2panda_rs::entry::{sign_and_encode, Entry};
use p2panda_rs::hash::Hash;
use p2panda_rs::identity::{Author, KeyPair};
use p2panda_rs::operation::{
AsOperation, Operation, OperationEncoded, OperationId, OperationValue, PinnedRelation,
PinnedRelationList, Relation, RelationList, VerifiedOperation,
AsOperation, AsVerifiedOperation, Operation, OperationEncoded, OperationId, OperationValue,
PinnedRelation, PinnedRelationList, Relation, RelationList, VerifiedOperation,
};
use p2panda_rs::schema::SchemaId;
use p2panda_rs::storage_provider::traits::{
Expand Down
4 changes: 2 additions & 2 deletions aquadoggo/src/db/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::collections::BTreeMap;
use p2panda_rs::document::{DocumentId, DocumentViewFields, DocumentViewId, DocumentViewValue};
use p2panda_rs::identity::Author;
use p2panda_rs::operation::{
Operation, OperationFields, OperationId, OperationValue, PinnedRelation, PinnedRelationList,
Relation, RelationList, VerifiedOperation,
AsVerifiedOperation, Operation, OperationFields, OperationId, OperationValue, PinnedRelation,
PinnedRelationList, Relation, RelationList, VerifiedOperation,
};
use p2panda_rs::schema::SchemaId;

Expand Down
Loading

0 comments on commit 5a1a845

Please sign in to comment.