Skip to content

Conversation

@tw-paraxial
Copy link

E2E tests now use a new seeder, and run in a dedicated container running cypress.
E2E test coverage to be improved later - this is initial set up.

@camjackson camjackson self-requested a review April 17, 2018 14:13
Copy link
Contributor

@camjackson camjackson left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, I'm excited to get it in master!

There are a few things I'd like to see done differently before merging, mostly to do with Docker things and scripting things and how we kind of orchestrate tasks locally.

See my comments below for details, and let me know if anything I said doesn't make sense :)


const createDefaultBranch = () => {
console.log('Creating default branch.');
const req = { body: { id: branchId, name: 'A branch' } };
Copy link
Contributor

@camjackson camjackson Apr 17, 2018

Choose a reason for hiding this comment

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

Looking at the branchesController, I'm pretty sure that the id you pass in here is going to be ignored - the controller generates an ID for you, so you don't need to pass one in. That means you can delete lines 16 & 17 too.

.catch(error => {
console.error('Seed failed:', error);
process.exit(1);
});
Copy link
Contributor

@camjackson camjackson Apr 17, 2018

Choose a reason for hiding this comment

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

The diff between this file and seed.js is tiny, so we've got a lot of copy-paste here. I think that's fine for a first cut while we're still working all this stuff out, but at some point it might be good for the two files to either: 1) converge and be parameterised somehow, or 2) have common stuff pulled out into a seed-utils.js or something. I wouldn't do it yet but just something to think about.

Also I think we can go ahead and just call this file e2e-seed.js, rather than -new. The old file contents are obsolete anyway, so no need to keep them around!

Copy link
Contributor

@torstenleibrich torstenleibrich Apr 18, 2018

Choose a reason for hiding this comment

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

In short: Yes to all your points. We should really take this out of the merge request. But in order to first test the e2e tests setup with cyprus to run a hello world in CI we need them to compile. Hence we raised this request early against the branch.

e2e-see-new.js is a pure copy and paste as it is very early stages of work in progress. We are using the seed as a reference and adopt from there. Refactoring needed for sure once we can add the e2e dependencies.

"seed": "node bin/seed.js && node bin/test-seed.js",
"start": "node index.js"
"start": "node index.js",
"start-test": "NODE_ENV=test node index.js"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm hesitant to add more scripts to the package.json, as it's already a bit out of control. Can we just do NODE_ENV=test yarn start anywhere we need this?

Copy link
Author

Choose a reason for hiding this comment

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

Personal preference - I see what you mean, but, this one feels like a useful shorthand that would be used relatively commonly, and also serves as documentation for future devs.

build:
context: docker/
dockerfile: Dockerfile.dev
dockerfile: Dockerfile.prod
Copy link
Contributor

Choose a reason for hiding this comment

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

What was the reason for renaming this file? We only use this particular Dockerfile in development, not for building production images.

Copy link
Author

Choose a reason for hiding this comment

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

I may have misunderstood the way that the script in bin/docker-build-and-deploy.sh works, then - I had thought that it recreated the rabblerouser/core image from the local image. I may have gotten a bit lost in the architecture, though.

TEST_STREAM_NAME: test_rabblerouser_stream
command: sleep 2147483647 # Sleep forever, we'll shell into the container later
stdin_open: true
user: $UID
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason you removed this? IIRC, we need this to make it run properly on a Linux host, as discovered by @akjones.

Copy link
Author

Choose a reason for hiding this comment

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

Ah, interesting.
I found that it threw potentially confusing warnings (as $UID is not an env variable on OSX), and was apparently redundant given the user creation in the dockerfile itself.
(If only docker was as portable as it claimed to be). Can re-add since there's a need.

"id": 8739,
"name": "Jane",
"email": "jane@example.com"
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this file or can we delete it?

"bs": "target end-to-end models"
}
}
] No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this file or can we delete it?

.travis.yml Outdated
script: ./go.sh yarn test
script:
- ./go.sh yarn test
- ./go.sh e2e
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment right at the end, but I think it might be better to just directly do ./bin/e2e.sh as the second command here.

go.sh Outdated
then
./bin/e2e.sh
exit
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Your comment above is correct that this is quite a different path/use case than the other things that we use go.sh for. With that in mind, I think it might better for it to just stay as a separate thing that can be run on its own, rather than making it a 'special case' of the go script.

Copy link
Author

Choose a reason for hiding this comment

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

Keen to revert this change, then.

go.sh Outdated
if [[ -z $1 ]];
then
docker-compose exec core /bin/sh
docker-compose exec core /bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you test this change? I think you'll find that bash is not present in Alpine linux, which is what the core image is built from. So it needs to be sh.

Copy link
Author

@tw-paraxial tw-paraxial Apr 18, 2018

Choose a reason for hiding this comment

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

I checked this change against the alpine image and it seemed fine - I suppose I can revert it.

edit My environment was unclean! Good catch.

@camjackson
Copy link
Contributor

Hey @tw-paraxial I'm going to take another look at this one. Just wanted to check where it's at from your point of view?

I.e., the original PR was kind of just a starting point, right? Is this still a work in progress, or is it ready to be merged as far as you're concerned?

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.

4 participants