Skip to content

Commit

Permalink
test: add integration test for incomplete key (#1460)
Browse files Browse the repository at this point in the history
* test: add integration test for incomplete key

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and jimit-j-shah committed Jun 13, 2024
1 parent a659872 commit 3a3c5fc
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public class ITDatastoreTest {
private static Key KEY3;
private static Key KEY4;
private static Key KEY5;
private static Key KEY6;
private static final String MARKS_KIND = "Marks";
private static FullEntity<IncompleteKey> PARTIAL_ENTITY1;
private static FullEntity<IncompleteKey> PARTIAL_ENTITY2;
Expand Down Expand Up @@ -193,6 +194,10 @@ public ITDatastoreTest(
KEY3 = Key.newBuilder(KEY2).setName("bla").setNamespace(NAMESPACE).build();
KEY4 = Key.newBuilder(KEY2).setName("newName1").setNamespace(NAMESPACE).build();
KEY5 = Key.newBuilder(KEY2).setName("newName2").setNamespace(NAMESPACE).build();
KEY6 =
Key.newBuilder(options.getProjectId(), KIND2, 100, options.getDatabaseId())
.setNamespace(NAMESPACE)
.build();

LIST_VALUE2 = ListValue.of(Collections.singletonList(KeyValue.of(KEY1)));

Expand Down Expand Up @@ -1787,6 +1792,21 @@ public void testGet() {
assertFalse(entity.contains("bla"));
}

@Test
public void testIncompleteKey() {
Key parentKey = null;
try {
IncompleteKey incompleteKey = IncompleteKey.newBuilder(KEY6, KIND1).build();
parentKey = incompleteKey.getParent();
Entity entity = Entity.newBuilder(parentKey).set("name", "val").build();
datastore.put(entity);
Entity retrievedEntity = datastore.get(parentKey);
assertThat(retrievedEntity).isEqualTo(entity);
} finally {
datastore.delete(parentKey);
}
}

@Test
public void testGetWithReadTime() throws InterruptedException {
Key key =
Expand Down

0 comments on commit 3a3c5fc

Please sign in to comment.