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

#106 Early version of test (required columns, json) #114

Merged
merged 25 commits into from
Jun 6, 2024
Merged

Conversation

Ciheim
Copy link
Collaborator

@Ciheim Ciheim commented Apr 22, 2024

This an early version of our testing infrastructure. This version looks for incorrect json modifications and empty values within required columns.

@Ciheim Ciheim self-assigned this Apr 22, 2024
@Ciheim
Copy link
Collaborator Author

Ciheim commented Apr 22, 2024

The script takes two arguments: (1) The path to the JSON that was generated by the catalog builder and (2) The path to the JSON template that was used for generation.

It is called using this format: test.py custom_json_path json_template_path

The script compares the json and returns any json sections that have changes (besides the catalog path section which we expect to change).

The script also grabs all required columns, as defined by the groupby_attrs section, and checks for any null values within them.

Here's an example I ran: test.py ~/output.json ../cats/gfdl_template.json

And here's the output:

attributes section of JSON does not refect template
source_id contains empty values
member_id contains empty values

@ceblanton
Copy link
Collaborator

The test is failing on from jsondiff import diff.

meta.yaml needs an update to install jsondiff.

@Ciheim
Copy link
Collaborator Author

Ciheim commented May 22, 2024

The test is failing on from jsondiff import diff.

meta.yaml needs an update to install jsondiff.

I made the change to environment.yml in #125 but you're right. I forgot to add it to meta.yaml. I'll remove the jsondiff change there and add both changes to this PR. Nice Catch.

@ceblanton
Copy link
Collaborator

what is environment.yaml used for? Almost too many yamls in the world (just kidding..)

@Ciheim
Copy link
Collaborator Author

Ciheim commented May 22, 2024

what is environment.yaml used for? Almost too many yamls in the world (just kidding..)

We expect users who want to run the tool directly to create an environment from this yaml

@ceblanton
Copy link
Collaborator

Hello, I tested this and think it is good and ready. I rephrased the error messages slightly and rephrased the try/except logic.

One thing I have mixed feelings about is that it gives the bad news in a drip-drip way rather than giving all the bad news at once. I think it's ok though as the problems are likely to be repeated. It would probably be worse to give the same error 1000x times for a 1000 line catalog.

@Ciheim
Copy link
Collaborator Author

Ciheim commented Jun 1, 2024

Hello, I tested this and think it is good and ready. I rephrased the error messages slightly and rephrased the try/except logic.

One thing I have mixed feelings about is that it gives the bad news in a drip-drip way rather than giving all the bad news at once. I think it's ok though as the problems are likely to be repeated. It would probably be worse to give the same error 1000x times for a 1000 line catalog.

Yes you're right about this. Thanks for the changes. Bennett and I noticed it so I put in a fix but the commit got a little messed up. Git errors bleh... I'll take care of this soon.

tests/test_catalog.py Show resolved Hide resolved
tests/test_catalog.py Show resolved Hide resolved
@ceblanton ceblanton merged commit c7e0cdb into main Jun 6, 2024
3 checks passed
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