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

Fix JSON encoding warnings in golden tests. #3247

Merged
merged 2 commits into from
Apr 22, 2022

Conversation

jonathanknowles
Copy link
Member

@jonathanknowles jonathanknowles commented Apr 22, 2022

Summary

This PR fixes warnings of the following type when running cardano-wallet-core:test:unit:

WARNING: Encoding new random samples do not match
lib/core/test/data/Cardano/Wallet/Api/ApiTypeName.json

Details

These warnings emanate from round-trip JSON encoding tests, and are caused by changes to underlying types (or generators) that are not accompanied by updates of the golden files.

This commit fixes this issue by regenerating the golden JSON files for types where warnings could be seen in the test log.

As a result, we can see that some data types have coverage that is more complete than before.

Examples

ApiAccountKey

We now cover shared account keys:

     "samples": [
-        "acct_xvk17d45ydqpaxgfn6cleg0wjyn4jwa3mpulqyqt0edcxqu9xl0xgzlqwv2gpvzgnautqq6vs96kh7xy3mhq6ulmgffnd92q2pzxk56h3ugwt055r",
-        "acct_xvk1t5hucj78c8a6tp7mg6yawpqsfv3jj3jwnua7lqd8hw985x3aavwndnjpcrn7xufmt983pj59h53uyw3hz5mtlcn2m8htya4ltnnzvwskxu4lg",
-        "acct_vk1zgfxrkh9hh5k3jtfx4them83sqtlkaeh6r746pp4q525z272hzequz0mzv",
-        "acct_xvk1h7ntzpvq56dsesexxhc2juejnsmd35sg9jkkeggxpfd9ypagywelxk03q6hv5xrs4h7r7gj8h3wamcrk9peyzd4334x8hdlehrnw77gnse8sk",
-        "acct_vk18t3c5gcw5c6ptg2hdzd47agr8gnz5ek5zmnd2qqge2vjz0h97u9sygp253",
-        "acct_vk157pl9lvysxulcwmee39afc2n83tp0edk03etgm4m09gyed0qfyssgncfe6",
-        "acct_vk1fwnwyhphwpclv59r4dr9ucsh3dmj243jl45772e2z2mpd4c0j3psdxjv6s",
-        "acct_xvk1efxvcetajem8yehnmmxd59y00e92n2ngpd32x86djsv9pq36w8hspagl6590kh0hgy4anv8m0sedn77fa6e9yypzf2ge62ftxdqxnrgn8tzy5",
-        "acct_xvk1l5e7juy5lw46uhslfdvmfrmzuf26azhj5suyj44r6xf9zeh4a874xdklkl676hvjxkurqwxqsdxpr5fye6v55xst894a5m8v3duepzsztqs57",
-        "acct_xvk14nf4re2c8kpme3xyw84ys3z48yrdxjqapxlw6vhggksu9nfcsdyhkr8dlmq3v2j3773zzqv5yzrt993ru0jr40qrfpd2qxwtn4ppwtgncwnzq"
+        "acct_shared_xvk1jsnrx395hzfx3nq4sxvrsdda8amz6zyq5kx37p0pmyxpnh4ya9yj7hec9vk7qrngs0a5pkykeu805829ftvj00mxhqrk8p2nrdhrrfcxnhv4r",
+        "acct_shared_vk1qkruhy3hxaqtkjyy3cgefra236lk0cdanmr3zfnxksxpujmjpnwqwc50ck",
+        "acct_shared_vk1lhgasafemhezu7fl25dkfkj8hzsnl4j6aeuzssffh6dmf86avsns6nulzr",
+        "acct_shared_xvk100cavmcspq45pw2cw49gzzldzctecn5a6w3cfyrmzustdp9vynv87mwvx3tps6a77uqf4xkh2txlt7prfrsw0lrateqqd7hlvsapppch5n6cu",
+        "acct_shared_vk1ltrzyjjvy2n6rq4c9vydcs9rnmchh00c67cxj9wntewq0pdfgjascwz53z",
+        "acct_shared_vk1599xlyyww6my9qpext89vszlk46jdnynwf69ffl6ewnf6j0ujcfqvd45ly",
+        "acct_shared_vk109nfu9vhrupctgays2vn894sageukjw9epezaxzpxa7m6usn5vtqdlut44",
+        "acct_shared_vk1tl63wah9ejqp60ex5524eerhz6mu6c3pvcqacmjalcq2j5frtz0sjm24q3",
+        "acct_vk1yhvt695w7e0t0ej7tqhzmcpepssydk9khzntp49j6y4yzcwkj7tqjv9un7",
+        "acct_xvk1dpvn4rvt2vrvr2wjsc9k5vsag9wqcecs47khtlgwj40j5gjc7vn7wg82fx8tw6etqjq42fph0d6ndngf3ef662ut3v7650h8jrkfl6qhsk83c"

ApiEra

We now cover more eras:

     "samples": [
         "allegra",
         "byron",
         "mary",
         "shelley",
+        "alonzo",
     ]
 }

When running `cardano-wallet:test:unit` on `master`, we see many warnings
of the following type:

```
    WARNING: Encoding new random samples do not match
    lib/core/test/data/Cardano/Wallet/Api/ApiTypeName.json
```

These warnings emanate from round-trip JSON encoding tests, and are
caused by changes to underlying types (or generators) that were not
accompanied by updates of the golden files.

This commit fixes this issue by regenerating the golden JSON files for
types where warnings could be seen in the test log.

As a result, we can see that some data types have coverage that is more
complete than before.

We now cover shared account keys:

```diff
     "samples": [
-        "acct_xvk17d45ydqpaxgfn6cleg0wjyn4jwa3mpulqyqt0edcxqu9xl0xgzlqwv2gpvzgnautqq6vs96kh7xy3mhq6ulmgffnd92q2pzxk56h3ugwt055r",
-        "acct_xvk1t5hucj78c8a6tp7mg6yawpqsfv3jj3jwnua7lqd8hw985x3aavwndnjpcrn7xufmt983pj59h53uyw3hz5mtlcn2m8htya4ltnnzvwskxu4lg",
-        "acct_vk1zgfxrkh9hh5k3jtfx4them83sqtlkaeh6r746pp4q525z272hzequz0mzv",
-        "acct_xvk1h7ntzpvq56dsesexxhc2juejnsmd35sg9jkkeggxpfd9ypagywelxk03q6hv5xrs4h7r7gj8h3wamcrk9peyzd4334x8hdlehrnw77gnse8sk",
-        "acct_vk18t3c5gcw5c6ptg2hdzd47agr8gnz5ek5zmnd2qqge2vjz0h97u9sygp253",
-        "acct_vk157pl9lvysxulcwmee39afc2n83tp0edk03etgm4m09gyed0qfyssgncfe6",
-        "acct_vk1fwnwyhphwpclv59r4dr9ucsh3dmj243jl45772e2z2mpd4c0j3psdxjv6s",
-        "acct_xvk1efxvcetajem8yehnmmxd59y00e92n2ngpd32x86djsv9pq36w8hspagl6590kh0hgy4anv8m0sedn77fa6e9yypzf2ge62ftxdqxnrgn8tzy5",
-        "acct_xvk1l5e7juy5lw46uhslfdvmfrmzuf26azhj5suyj44r6xf9zeh4a874xdklkl676hvjxkurqwxqsdxpr5fye6v55xst894a5m8v3duepzsztqs57",
-        "acct_xvk14nf4re2c8kpme3xyw84ys3z48yrdxjqapxlw6vhggksu9nfcsdyhkr8dlmq3v2j3773zzqv5yzrt993ru0jr40qrfpd2qxwtn4ppwtgncwnzq"
+        "acct_shared_xvk1jsnrx395hzfx3nq4sxvrsdda8amz6zyq5kx37p0pmyxpnh4ya9yj7hec9vk7qrngs0a5pkykeu805829ftvj00mxhqrk8p2nrdhrrfcxnhv4r",
+        "acct_shared_vk1qkruhy3hxaqtkjyy3cgefra236lk0cdanmr3zfnxksxpujmjpnwqwc50ck",
+        "acct_shared_vk1lhgasafemhezu7fl25dkfkj8hzsnl4j6aeuzssffh6dmf86avsns6nulzr",
+        "acct_shared_xvk100cavmcspq45pw2cw49gzzldzctecn5a6w3cfyrmzustdp9vynv87mwvx3tps6a77uqf4xkh2txlt7prfrsw0lrateqqd7hlvsapppch5n6cu",
+        "acct_shared_vk1ltrzyjjvy2n6rq4c9vydcs9rnmchh00c67cxj9wntewq0pdfgjascwz53z",
+        "acct_shared_vk1599xlyyww6my9qpext89vszlk46jdnynwf69ffl6ewnf6j0ujcfqvd45ly",
+        "acct_shared_vk109nfu9vhrupctgays2vn894sageukjw9epezaxzpxa7m6usn5vtqdlut44",
+        "acct_shared_vk1tl63wah9ejqp60ex5524eerhz6mu6c3pvcqacmjalcq2j5frtz0sjm24q3",
+        "acct_vk1yhvt695w7e0t0ej7tqhzmcpepssydk9khzntp49j6y4yzcwkj7tqjv9un7",
+        "acct_xvk1dpvn4rvt2vrvr2wjsc9k5vsag9wqcecs47khtlgwj40j5gjc7vn7wg82fx8tw6etqjq42fph0d6ndngf3ef662ut3v7650h8jrkfl6qhsk83c"
```

We now cover more eras:

```diff
     "samples": [
         "allegra",
         "byron",
         "mary",
         "shelley",
+        "alonzo",
     ]
 }
```
Copy link
Contributor

@piotr-iohk piotr-iohk left a comment

Choose a reason for hiding this comment

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

👍

@jonathanknowles
Copy link
Member Author

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Apr 22, 2022

Build succeeded:

@iohk-bors iohk-bors bot merged commit f7bc922 into master Apr 22, 2022
@iohk-bors iohk-bors bot deleted the jonathanknowles/fix-golden-json-encoding-warnings branch April 22, 2022 08:00
WilliamKingNoel-Bot pushed a commit that referenced this pull request Apr 22, 2022
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