Skip to content

chore(entity-query-service): better integration tests for update API #128

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

skjindal93
Copy link
Contributor

No description provided.

@skjindal93 skjindal93 requested a review from a team September 2, 2021 16:26
@codecov
Copy link

codecov bot commented Sep 2, 2021

Codecov Report

Merging #128 (1c56151) into main (7305e9d) will increase coverage by 0.75%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #128      +/-   ##
============================================
+ Coverage     59.71%   60.46%   +0.75%     
  Complexity      303      303              
============================================
  Files            39       39              
  Lines          3043     3043              
  Branches        376      376              
============================================
+ Hits           1817     1840      +23     
+ Misses         1053     1028      -25     
- Partials        173      175       +2     
Flag Coverage Δ
integration 60.46% <ø> (+0.75%) ⬆️
unit 40.63% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ace/entity/query/service/EntityQueryConverter.java 37.96% <0.00%> (+8.64%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7305e9d...1c56151. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Sep 2, 2021

Unit Test Results

  31 files  ±0    31 suites  ±0   24s ⏱️ -1s
143 tests ±0  143 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 1c56151. ± Comparison against base commit 7305e9d.

@@ -734,4 +788,10 @@ private static Datastore getDatastore() {

return attributesMap;
}

private <T> void assertListEquals(List<T> expected, List<T> actual) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't this just use assertEquals?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that. It wasn't working with the basic assertEquals, though it should have

Didn't spend much time on why it wasn't working

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, worth figuring out - something's off here. This check for example doesn't assert that their order matches, which is part of list equality.

@@ -484,6 +489,11 @@ public void testBulkUpdate() {
.setTenantId(TENANT_ID)
.setEntityType(EntityType.API.name())
.setEntityName("api1")
.putAttributes(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add an integer to the integration test, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support updating INT yet via EQS update APIs. Planning to add support for that in a separate PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't? maybe I'm misunderstanding or looking in the wrong spot, but it sure looks like we do - unless it's in the API but not the implementation?

message UpdateOperation {
  oneof operation {
    SetAttribute setAttribute = 1;
    // more update operations in the future
  }
}

->

message SetAttribute {
  ColumnIdentifier attribute = 1;
  LiteralConstant value = 2;
}

->

message LiteralConstant {
  Value value = 1;
}

->

message Value {
  ValueType valueType = 1;

  string string = 3;
  int64 long = 4;
  int32 int = 5;
  float float = 6;
  double double = 7;
  bytes bytes = 8;
  bool boolean = 9;
  sfixed64 timestamp = 15;
  repeated string string_array = 16;
  repeated int64 long_array = 17;
  repeated int32 int_array = 18;
  repeated float float_array = 19;
  repeated double double_array = 20;
  repeated bytes bytes_array = 21;
  repeated bool boolean_array = 22;
  map<string, string> string_map = 23;
}

Copy link
Contributor

@aaron-steinfeld aaron-steinfeld Sep 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, the implementation only has long in its switch, not int. That's really confusing, but is actually right (other than the fact that it should yell loudly and not have it in its interface)- entities only have long fields, not int.

...and just to clarify further, because this is a complete mess - Entity the object returned by EDS can actually hold both int and long, and Row the EQS response can hold both (and those two don't match WRT certain other data types 😢 ), but our attribute schema, which represents the entity field data types does not have an int type - and our attribute schema should be the source of truth here.

So tl;dr - we shouldn't add support for int, but could we add long to the test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants