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

Add unit test for transaction metadata fee calculation #2108

Merged
merged 3 commits into from
Sep 5, 2020

Conversation

rvl
Copy link
Contributor

@rvl rvl commented Sep 3, 2020

Issue Number

ADP-307 / #2075

Overview

  • Property tests that the fee calculation produces a higher result when there is metadata present.
  • The test is along the lines of the withdrawal fee calculation test, which I reworded slightly.

@rvl rvl added the ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG label Sep 3, 2020
@rvl rvl added this to the (ADP-307) Transaction metadata milestone Sep 3, 2020
@rvl rvl requested review from KtorZ and piotr-iohk September 3, 2020 00:46
@rvl rvl self-assigned this Sep 3, 2020
Copy link
Contributor

@jonathanknowles jonathanknowles left a comment

Choose a reason for hiding this comment

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

LGTM! I have a couple of suggestions (see comments).

Copy link
Member

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

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

bors r+

@Anviking
Copy link
Member

Anviking commented Sep 3, 2020

bors r+

iohk-bors bot added a commit that referenced this pull request Sep 3, 2020
2108: Add unit test for transaction metadata fee calculation r=Anviking a=rvl

### Issue Number

ADP-307 / #2075 

### Overview

- Property tests that the fee calculation produces a higher result when there is metadata present.
- The test is along the lines of the withdrawal fee calculation test, which I reworded slightly.


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: KtorZ <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 3, 2020

Build failed


Progress 5/6: cardano-wallet-2020.8.3
--
  | Timed out after 60 minutes.

@Anviking
Copy link
Member

Anviking commented Sep 3, 2020

🤔
bors r+

iohk-bors bot added a commit that referenced this pull request Sep 3, 2020
2108: Add unit test for transaction metadata fee calculation r=Anviking a=rvl

### Issue Number

ADP-307 / #2075 

### Overview

- Property tests that the fee calculation produces a higher result when there is metadata present.
- The test is along the lines of the withdrawal fee calculation test, which I reworded slightly.


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: KtorZ <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 3, 2020

Build failed

stack --color always test --fast --skip jormungandr-integration --ta '--match SERIAL --jobs 1' --jobs 1 --flag cardano-wallet-core-integration:release --flag cardano-wallet-core:release --flag cardano-wallet-test-utils:release --flag cardano-wallet-jormungandr:release --flag text-class:release --flag cardano-wallet-launcher:release --flag cardano-wallet:release --flag cardano-wallet-cli:release

cardano-wallet-2020.8.3: test (suite: integration, args: --match SERIAL --jobs 1)
cardano-wallet-2020.8.3: Test suite integration passed
cardano-wallet-2020.8.3: test (suite: unit, args: --match SERIAL --jobs 1)
cardano-wallet-2020.8.3: Test suite unit passed
cardano-wallet-cli-2020.8.3: test (suite: unit, args: --match SERIAL --jobs 1)
cardano-wallet-cli-2020.8.3: Test suite unit passed
cardano-wallet-core-2020.8.3: test (suite: unit, args: --match SERIAL --jobs 1)
cardano-wallet-core-2020.8.3: Test suite unit passed
cardano-wallet-jormungandr-2020.8.3: test (suite: unit, args: --match SERIAL --jobs 1)
cardano-wallet-jormungandr-2020.8.3: Test suite unit passed
cardano-wallet-launcher-2020.8.3: test (suite: unit, args: --match SERIAL --jobs 1)
cardano-wallet-launcher-2020.8.3: Test suite unit passed
text-class-2020.8.3: test (suite: unit, args: --match SERIAL --jobs 1)
text-class-2020.8.3: Test suite unit passed
Completed 6 action(s).
Log files have been written to: /build/cardano-wallet/.stack-work/logs/


stack --color always test --fast --skip jormungandr-integration --ta '--skip SERIAL' --flag cardano-wallet-core-integration:release --flag cardano-wallet-core:release --flag cardano-wallet-test-utils:release --flag cardano-wallet-jormungandr:release --flag text-class:release --flag cardano-wallet-launcher:release --flag cardano-wallet:release --flag cardano-wallet-cli:release

cardano-wallet-2020.8.3: test (suite: integration, args: --skip SERIAL)
cardano-wallet-cli-2020.8.3: test (suite: unit, args: --skip SERIAL)
cardano-wallet-core-2020.8.3: test (suite: unit, args: --skip SERIAL)
cardano-wallet-jormungandr-2020.8.3: test (suite: unit, args: --skip SERIAL)
cardano-wallet-launcher-2020.8.3: test (suite: unit, args: --skip SERIAL)
text-class-2020.8.3: test (suite: unit, args: --skip SERIAL)
text-class-2020.8.3: Test suite unit passed
cardano-wallet-cli-2020.8.3: Test suite unit passed
cardano-wallet-launcher-2020.8.3: Test suite unit passed
cardano-wallet-jormungandr-2020.8.3: Test suite unit passed
cardano-wallet-core-2020.8.3: Test suite unit passed
Progress 5/6: cardano-wallet-2020.8.3
Timed out after 60 minutes.

@rvl rvl force-pushed the rvl/2075/metadata-fee-test branch from d067570 to 02c367b Compare September 4, 2020 09:48
@Anviking
Copy link
Member

Anviking commented Sep 4, 2020

bors r+

iohk-bors bot added a commit that referenced this pull request Sep 4, 2020
2108: Add unit test for transaction metadata fee calculation r=Anviking a=rvl

### Issue Number

ADP-307 / #2075 

### Overview

- Property tests that the fee calculation produces a higher result when there is metadata present.
- The test is along the lines of the withdrawal fee calculation test, which I reworded slightly.


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: KtorZ <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 4, 2020

Build failed

 test/unit/Network/Wai/Middleware/LoggingSpec.hs:119:5:
  1) Network.Wai.Middleware.Logging, Logging Middleware, GET, 200, no query
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/get"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 200, no query/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:130:5:
  2) Network.Wai.Middleware.Logging, Logging Middleware, GET, 200, with query
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/get"
         queryString          = "?query=patate"
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 200, with query/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:141:5:
  3) Network.Wai.Middleware.Logging, Logging Middleware, GET, 200, not json
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/not-json"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 200, not json/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:152:5:
  4) Network.Wai.Middleware.Logging, Logging Middleware, POST, 201, with sensitive fields
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = [("Content-Type","application/json")]
         path                 = "/post"
         queryString          = ""
         method               = "POST"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/POST, 201, with sensitive fields/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:163:5:
  5) Network.Wai.Middleware.Logging, Logging Middleware, POST, 400, invalid payload (not json)
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = [("Content-Type","application/json")]
         path                 = "/post"
         queryString          = ""
         method               = "POST"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/POST, 400, invalid payload (not json)/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:174:5:
  6) Network.Wai.Middleware.Logging, Logging Middleware, DELETE, 202, no query
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/delete"
         queryString          = ""
         method               = "DELETE"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/DELETE, 202, no query/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:185:5:
  7) Network.Wai.Middleware.Logging, Logging Middleware, GET, 400
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/error400"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 400/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:196:5:
  8) Network.Wai.Middleware.Logging, Logging Middleware, GET, 500
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/error500"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 500/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:207:5:
  9) Network.Wai.Middleware.Logging, Logging Middleware, GET, 503
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/error503"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 503/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:218:5:
  10) Network.Wai.Middleware.Logging, Logging Middleware, different request ids
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/get"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout
       (after 1 test and 6 shrinks)
         NumberOfRequests 1

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/different request ids/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:227:5:
  11) Network.Wai.Middleware.Logging, Logging Middleware, correct time measures
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/long"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout
       (after 1 test)
         (NumberOfRequests 1,RandomIndex 0)

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/correct time measures/"

Randomized with seed 257783517

@Anviking
Copy link
Member

Anviking commented Sep 4, 2020

bors r+

iohk-bors bot added a commit that referenced this pull request Sep 4, 2020
2108: Add unit test for transaction metadata fee calculation r=Anviking a=rvl

### Issue Number

ADP-307 / #2075 

### Overview

- Property tests that the fee calculation produces a higher result when there is metadata present.
- The test is along the lines of the withdrawal fee calculation test, which I reworded slightly.


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: KtorZ <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 4, 2020

Build failed

Failures:

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:119:5:
  1) Network.Wai.Middleware.Logging, Logging Middleware, GET, 200, no query
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/get"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 200, no query/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:130:5:
  2) Network.Wai.Middleware.Logging, Logging Middleware, GET, 200, with query
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/get"
         queryString          = "?query=patate"
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 200, with query/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:141:5:
  3) Network.Wai.Middleware.Logging, Logging Middleware, GET, 200, not json
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/not-json"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 200, not json/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:152:5:
  4) Network.Wai.Middleware.Logging, Logging Middleware, POST, 201, with sensitive fields
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = [("Content-Type","application/json")]
         path                 = "/post"
         queryString          = ""
         method               = "POST"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/POST, 201, with sensitive fields/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:163:5:
  5) Network.Wai.Middleware.Logging, Logging Middleware, POST, 400, invalid payload (not json)
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = [("Content-Type","application/json")]
         path                 = "/post"
         queryString          = ""
         method               = "POST"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/POST, 400, invalid payload (not json)/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:174:5:
  6) Network.Wai.Middleware.Logging, Logging Middleware, DELETE, 202, no query
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/delete"
         queryString          = ""
         method               = "DELETE"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/DELETE, 202, no query/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:185:5:
  7) Network.Wai.Middleware.Logging, Logging Middleware, GET, 400
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/error400"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 400/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:196:5:
  8) Network.Wai.Middleware.Logging, Logging Middleware, GET, 500
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/error500"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 500/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:207:5:
  9) Network.Wai.Middleware.Logging, Logging Middleware, GET, 503
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/error503"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/GET, 503/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:218:5:
  10) Network.Wai.Middleware.Logging, Logging Middleware, different request ids
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/get"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout
       (after 1 test and 6 shrinks)
         NumberOfRequests 1

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/different request ids/"

  test/unit/Network/Wai/Middleware/LoggingSpec.hs:227:5:
  11) Network.Wai.Middleware.Logging, Logging Middleware, correct time measures
       uncaught exception: HttpException
       HttpExceptionRequest Request {
         host                 = "localhost"
         port                 = 55483
         secure               = False
         requestHeaders       = []
         path                 = "/long"
         queryString          = ""
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
       }
        ConnectionTimeout
       (after 1 test)
         (NumberOfRequests 1,RandomIndex 0)

  To rerun use: --match "/Network.Wai.Middleware.Logging/Logging Middleware/correct time measures/"

Randomized with seed 257783517

Finished in 1379.0653 seconds
1711 examples, 11 failures, 2 pending
builder for '/nix/store/pk6p081gv62q5fhbib452zwjbhwxnjys-cardano-wallet-core-test-unit-2020.8.3-check.drv' failed with exit code 1

@Anviking
Copy link
Member

Anviking commented Sep 5, 2020

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 5, 2020

Build succeeded

@iohk-bors iohk-bors bot merged commit fdd71c6 into master Sep 5, 2020
@iohk-bors iohk-bors bot deleted the rvl/2075/metadata-fee-test branch September 5, 2020 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants