-
Notifications
You must be signed in to change notification settings - Fork 5
[DRAFT] hello-world & runtime-script cloud functions and testing #566
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
base: main
Are you sure you want to change the base?
Conversation
|
ci passes but i dont see functions in there, idk if there will be an issue with running these function tests in ci/cd |
88b0b06 to
2aa7b8d
Compare
| import React from 'react'; | ||
| import { render, cleanup } from '@testing-library/react'; | ||
| import '@testing-library/jest-dom/extend-expect'; | ||
| import '@testing-library/jest-dom'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this PR needs to touch the graphql/ dir.
| res.status(200).json({ message: error.message }); | ||
| }); | ||
| app.listen(port, cb); | ||
| return app.listen(port, cb); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe changes to the jobs/knative-job-fn not required in thie PR. If we have a cleanup or lint PR, could be seperated out?
| } from '@constructive-io/job-utils'; | ||
|
|
||
| // this module exists to fail fast on missing env | ||
| // it is intentionally evaluated at import time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe not required or we need to create it as a standard for all the packages. We purposefully moved away from envvalid for all the jobs, that were enforcing env variables in favour of the @pgpm/env. So maybe we dont do this here.
| // this module exists to fail fast on missing env | ||
| // it is intentionally evaluated at import time | ||
|
|
||
| function normalizeBaseUrl(raw: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function i am all in for. We should have a normalization process. will make it better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be moved to job-utils??
| } | ||
|
|
||
| const rawGatewayUrl = | ||
| process.env.KNATIVE_SERVICE_URL || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont use process.env but @pgpm/env pacakge. I think have a look into the jobs-utils.
| @@ -0,0 +1,173 @@ | |||
| import { Logger } from '@pgpmjs/logger'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we seperate out the PR for pgpm dump from the hello-world function??
If they are related I might be missing something?
| FROM node:20-alpine | ||
|
|
||
| # Install Postgres and Bash | ||
| RUN apk add --no-cache postgresql postgresql-client postgresql-contrib bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you tell me about the Dockerfile.test, what it is going to be used for? I might not be understanding it correctly.
draft on two new functions, for
hello-worldandruntime-script, and now each function has tests in it that use pgsql-test. We are now connecting to a db locally (within the container) (each function has its own emphemeral db), and also connecting over the name service to connect to our internal db. I want to do some more sanity checks but heres a solid draft @Anmol1696 . will also look at merge conflictsand we were able to use
kubernetesjs, even though we can do some consolidation of utils likeconstructive/functions/*/__tests__/k8s-utils.ts, and maybe put it intokubernetes-testcontributions
dependencies & configuration:
graphql/codegen (major overhaul):
pgpm/core & cli:
also was testing with these:
https://github.com/constructive-io/constructive-cloud/pull/67