-
Notifications
You must be signed in to change notification settings - Fork 299
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 testing information #1253
Add testing information #1253
Conversation
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
- | Generic High Entropy Secret | 7c6a931 | tests/unit/fluxCommunicationMessagesSender.test.js | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
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.
Ack. Nice job!
@@ -41,7 +41,7 @@ async function connectMongoDb(url) { | |||
* @returns true | |||
*/ | |||
async function initiateDB() { | |||
openDBConnection = await connectMongoDb(); | |||
if (!openDBConnection) openDBConnection = await connectMongoDb(); |
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 one is a nice catch.
Adds an images directory under tests.
Maybe we can get some fresh png(s) from marketing to update the repo? (I've just referenced the main
flux_banner.png
)I'm not sure how you all run your tests, or what workflows you use. I've struggled in this area and my testing has been quite janky. I couldn't find any documentation for testing procedure, so I went out on a limb and wrote my own.
Basically, it builds / runs a few containers, mounts your docker socket and local repo dir, then runs all the tests as the
fluxtesting
user in an ubuntu container. (while proxying the docker socket from a socat container, to allow for running as non root)Tested on both macOS and Ubuntu.
Have a look at the readme:
tests/images/README.md
, describes how to run the tests and some notes etc.Allows for rapid prototyping as you can modify the code then run the tests immediately, and single out tests etc.
As npm install can take significant time,
package.json
is hashed so it doesn't have to run the installer on every run (first time is mandatory)A few of things to note:
initiateDB
on every test, which was opening a new connection instead of using the existing connection pool. So I've added to open a DB connection if there isn't one already existing. (As the mongo client handles connection pooling, reconnection etc)..mocharc.json
file with a require that sets up theglobal.userconfig
this was in some of the tests as a require and in others it wasn't. Meaning that if all the tests were run, it was fine. However if you ran some modules individually they would fail, as they weren't pulling in the require. (egdockerService.test.js
) I've since removed the requires from all the tests as this is required globally via .mocharc.json.os.homedir
instead of many relative ../, this was meaning that flux HAD to be installed two directories below the homedir for testing, now it can go anywhere.dbHelper.js change:
I've tested this on a live node and can see still getting connection pooling etc:
macOS: (local development)
Ubuntu: (one of my local vm's)