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

Standard Tests: allow specifying exact record matches #2186 #2960

Merged
merged 11 commits into from
Apr 30, 2021

Conversation

keu
Copy link
Contributor

@keu keu commented Apr 19, 2021

closes #2186

What

Describe what the change is solving
It helps to add screenshots if it affects the frontend.

How

Describe the solution

Recommended reading order

  1. test.java
  2. component.ts
  3. the rest

@keu keu requested review from sherifnada, yevhenii-ldv and vitaliizazmic and removed request for ChristopheDuong and cgardens April 19, 2021 21:05
Copy link
Contributor

@sherifnada sherifnada left a comment

Choose a reason for hiding this comment

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

why AirbyteRecordMessage instead AirbyteMessage?

path = getattr(inputs, "expected_records_path")
if not path:
return []

with open(str(base_path / path)) as f:
return [AirbyteMessage.parse_raw(line) for line in f]
return [AirbyteRecordMessage.parse_raw(line) for line in f]
Copy link
Contributor

Choose a reason for hiding this comment

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

why not make this AirbyteMessage in case we want to do some state as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my logic here was the following:

  • it is expected records
  • STATE objects are kind of black boxes IIRC
  • I don't think we should assert on LOG messages
  • it is easier to provide records, ideally just data attribute, but we need to know the stream name

@keu keu linked an issue Apr 20, 2021 that may be closed by this pull request
Base automatically changed from keu/standard-python-tests to master April 20, 2021 19:26
+ extra_fields
+ exact_order
+ extra_records
@keu keu force-pushed the keu/standard-python-tests-records-assert branch from 365d9eb to 7822264 Compare April 29, 2021 19:53
@keu keu requested a review from sherifnada April 29, 2021 21:19
Copy link
Contributor

@sherifnada sherifnada left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -13,6 +13,11 @@ tests:
- config_path: "secrets/config.json"
configured_catalog_path: "sample_files/configured_catalog.json"
validate_output_from_all_streams: yes
expect_records:
Copy link
Contributor

Choose a reason for hiding this comment

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

why not call it expected_records? it follows the expected/actual naming convention for tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

originally it was so, but in the test we have expected_records fixture that an actual records we expect, and config class inputs.expected_records (inputs.expected_records.extra_fields, etc) which might cause confusion.

| `expect_records.exact_order` | boolean | False | Ensure that records produced in exact same order|
| `expect_records.extra_records` | boolean | True | Allow connector to produce extra records, but still enforce all records from the expected file to be produced|

`expect_records` is a nested configuration, if omitted - the part of the test responsible for record matching will be skipped. Due to the fact that we can't identify records without primary keys matching flags support only the following combinations:
Copy link
Contributor

Choose a reason for hiding this comment

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

are Airbyte field e.g: emitted_at counted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, we explicitly remove metadata, only record itself used for comparision

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the only reason I pack expected records into AirbyteRecordMessages and not just dicts is that we need the name of the stream and I don't want to have separate file for each stream

keu and others added 3 commits April 30, 2021 01:38
…eptance-tests.md

Co-authored-by: Sherif A. Nada <snadalive@gmail.com>
…tance_test/tests/test_core.py

Co-authored-by: Sherif A. Nada <snadalive@gmail.com>
…eptance-tests.md

Co-authored-by: Sherif A. Nada <snadalive@gmail.com>
@keu keu merged commit 7f66569 into master Apr 30, 2021
@keu keu deleted the keu/standard-python-tests-records-assert branch April 30, 2021 08:21
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.

Standard Tests: allow specifying exact record matches
3 participants