Skip to content

Add CI that checks weather lookups are stored and served - #3

Merged
HarshCasper merged 2 commits into
mainfrom
ci/assert-weather-and-history
Oct 13, 2026
Merged

HarshCasper merged 2 commits into
mainfrom
ci/assert-weather-and-history

Conversation

@HarshCasper

@HarshCasper HarshCasper commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

The repo had no CI and no test.

  • New test.sh (make test):
    • runs db-setup and expects a 200
    • checks the weather for a city through API Gateway (GET /dev/weather/{location})
    • reads the stored check back from GET /dev/history/{location}, which proves the weather Lambda wrote both rows through the RDS proxy
    • checks a city that was never looked up has no history
  • OpenWeather without a key: the weather Lambda reads OPEN_WEATHER_BASE_URL (default: the real API). CI points it at an S3 object, and the test fills it with the fixtures in tests/fixtures:
    • Lisbon, 24.5 °C, clear: "quite nice", stored with niceWeather: true
    • Oslo, 8.2 °C, overcast: "not so nice", stored with niceWeather: false
    • Without the stub, the test calls the real API for $CITY (default London) and checks the response shape only.
  • New workflow: Java 21, Terraform, lstk, then make build, make deploy and make test. On failure it prints the Lambda logs and LocalStack logs.

Sample fixes:

  • terraform-local passed the proxy endpoint without a port, so JDBC used 5432. LocalStack serves the database on the cluster port, so HOST is now <proxy endpoint>:<cluster port>.
  • terraform-local used the route keys OPTIONS /weather/ and OPTIONS /history/, which API Gateway rejects ("Part of the given route key path is empty"), so the deploy failed. They now match terraform/: OPTIONS /weather/{location} and OPTIONS /history/{location}.
  • db-setup failed on a second run. It now uses CREATE TABLE IF NOT EXISTS.
  • The weather Lambda now URL-encodes the city, so names with spaces work.
  • The committed jars for weather-lambda and db-setup-lambda are rebuilt from the changed sources.
  • New make build and make test targets, and a README section on testing.

Verified by CI.

https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM

Add test.sh and a workflow that deploy the app to LocalStack, check the
weather for a city through API Gateway and read it back from the history
API. CI serves the OpenWeather responses from an S3 stub, so it needs no
API key. Connect to the RDS proxy on the cluster port, and make db-setup
safe to run twice.

Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM
terraform-local used 'OPTIONS /weather/' and 'OPTIONS /history/'. API Gateway rejects a route key with an empty path part, so the deploy failed. terraform/ already uses '/{location}'.

Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM
@HarshCasper
HarshCasper merged commit 6e86da4 into main Oct 13, 2026
1 check 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.

1 participant