Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sigurdm committed Sep 10, 2024
1 parent bd4b9de commit 1927791
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
3 changes: 3 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ analyzer:
errors:
# This is triggered in generated code.
unnecessary_import: ignore

exclude:
- tmp/**
2 changes: 1 addition & 1 deletion test/integration/db/metamodel_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ runTests(datastore, db.DatastoreDB store, String uniquePostfix) {
try {
for (final namespace in [null, 'FooNamespace', 'BarNamespace']) {
// TODO: Partition.newPartition should be updated to accept null.
final partition = store.newPartition(namespace ?? '');
final partition = db.Partition(namespace);
final kindQuery = store.query<Kind>(partition: partition);
final List<Kind> kinds = await kindQuery.run().cast<Kind>().toList();

Expand Down
25 changes: 13 additions & 12 deletions test/integration/grpc_datastore_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:appengine/src/grpc_api_impl/datastore_impl.dart';
import 'package:gcloud/db.dart' as db;
import 'package:grpc/grpc.dart' as grpc;
import 'package:test/test.dart' as test;
import 'db/db_tests.dart' as db_tests;
import 'db/metamodel_tests.dart' as metamodel_tests;

import 'common_e2e.dart' show onBot, withAuthenticator;
import 'raw_datastore_test_impl.dart' as datastore_tests;
Expand All @@ -16,10 +18,9 @@ main() async {
final endpoint = 'datastore.googleapis.com';

final String nsPrefix = Platform.operatingSystem;

test.group('grpc datastore', () {
withAuthenticator(OAuth2Scopes,
(String project, grpc.HttpBasedAuthenticator authenticator) async {
await withAuthenticator(OAuth2Scopes,
(String project, grpc.HttpBasedAuthenticator authenticator) async {
test.group('grpc datastore', () {
final clientChannel = grpc.ClientChannel(endpoint);
final datastore =
GrpcDatastoreImpl(clientChannel, authenticator, project);
Expand All @@ -36,12 +37,12 @@ main() async {
datastore, '${nsPrefix}${DateTime.now().millisecondsSinceEpoch}');

// Run high-level db tests.
/* db_tests.runTests(
dbService, '${nsPrefix}${DateTime.now().millisecondsSinceEpoch}');
// Run metamodel tests.
metamodel_tests.runTests(datastore, dbService,
'${nsPrefix}${DateTime.now().millisecondsSinceEpoch}');*/
});
}, skip: onBot());
db_tests.runTests(
dbService, '${nsPrefix}${DateTime.now().millisecondsSinceEpoch}');

// Run metamodel tests.
metamodel_tests.runTests(datastore, dbService,
'${nsPrefix}${DateTime.now().millisecondsSinceEpoch}');
}, skip: onBot());
});
}
6 changes: 3 additions & 3 deletions test/integration/raw_datastore_test_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@ runTests(Datastore datastore, String namespace) {
skip: 'With Firestore in Datastore mode, transactions are no longer '
'limited to 25 entity groups');

test('negative_insert_20000_entities', () {
test('insert_20000_entities', () async {
// Maybe it should not be a [DataStoreError] here?
expect(datastore.commit(inserts: named20000),
throwsA(isDatastoreApplicationError));
final result = await datastore.commit(inserts: named20000);
expect(result.autoIdInsertKeys.length, 0);
});

// TODO: test invalid inserts (like entities without key, ...)
Expand Down

0 comments on commit 1927791

Please sign in to comment.