npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

billing-allocation-service-api

v0.1.1

Published

Ply tests for billing-allocation-service-api

Downloads

4

Readme

API Automated Tests

Test data

The eis-api-test Docker image contains a PostgreSQL EIS database which is empty except for certain seed data such as users webinspect and torvalds.

Pull and run eis-api-test image from nexus:

docker login nexusprod.corp.intranet:4567 -u <username>
docker run -d --name eis-api-test -p 5432:5432 -p 8081:8081 -e POSTGRES_PASSWORD=eis nexusprod.corp.intranet:4567/eis/eis-api-test:1.2.4

Insert eis-order-notification test data:

cd src/test/resources/data
./seed.sh 
(or seed.cmd)

Configure eis-order-notification to use this datasource for Ply test execution:

host: localhost
port: 5432
database: eisdev
username: eis
password: eis

Authentication

The eis-api-test image described above also contains the EIS Auth API. When run with -p 8081:8081, the image will make eis-auth endpoints accessible locally. Configure eis-order-notification eis.auth.endpoint to use http://localhost:8081. A working API key is built into the container image. Set environment variable EIS_API_TOKEN, which is referenced in src/test/ply/values/localhost.com for API authentication. See Ply Values documentation.

MockServer

The order-notifications/attachment endpoint submits a client HTTP request to the socn.endpoint URL. During API test execution, this endpoint is mocked using MockServer. The canned response is returned by SocnAttachmentMock. To start the mock server manually, run the main() method in this class.

Running tests

API tests are executed by the api-test profile during Maven's 'verify' phase. The following command runs the Ply tests and validates the results (timezone ensure expected results sentTime agreement):

mvn verify -P api-test -Dspring-boot.run.jvmArguments="-Duser.timezone=America/Denver"

Example output with api-test success:

[INFO] Overall Results: {"Passed":12,(:0,"Errored":0,"Pending":0,"Submitted":0}
[INFO] Overall Time: 8195 ms

Example output with failed test

[INFO] Request 'attachmentForOrderId' FAILED in 2824 ms: Results differ from line 8
[INFO] 8-9
[INFO] -       code: 200
[INFO] -       message: OK
[INFO] +       code: 404
[INFO] +       message: Not Found
[INFO] ===
[INFO] 11-14
[INFO] -       access-control-expose-headers: Content-Disposition
[INFO] -       content-disposition: attachment; filename="CTL-TACR-${filters.orderId}-test_accept_rpt.txt"
[INFO] -       content-type: application/octet-stream
[INFO] -     body: \x5441434e206e6f74696669636174696f6e
[INFO] +       content-type: application/json
[INFO] +     body: |-
[INFO] +       {
[INFO] +         "message": "Cannot find orderId MNS-44367V2 attachment",
[INFO] +         "status": "NOT_FOUND"
[INFO] +       }
[INFO] ===
...
...
[INFO] Overall Results: {"Passed":11,"Failed":1,"Errored":0,"Pending":0,"Submitted":0}

VS Code Extension

Install the Ply VS Code extension to run API tests interactively through VS Code.

Follow the setup steps above, then manually start the EisOrderNotification Spring Boot app. Also start the SocnAttachmentMock server. Open the Test Explorer view in VS Code, and execute the Ply tests. vscode-ply