Skip to content
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 ember try:fastboot #53

Closed
wants to merge 2 commits into from
Closed

Add ember try:fastboot #53

wants to merge 2 commits into from

Conversation

kategengler
Copy link
Member

It installs ember-cli-fastboot, runs ember fastboot, then waits for the command to either exit or hit the timeout (Default 30s). Hitting the timeout means the command has succeeded in starting up a server, so this timeout may need to be adjusted longer for apps or addons with long build times.

Potential future improvements: We could separately run ember fastboot:build and ember fastboot to avoid more possible false success scenarios (when the timeout occurs before the server has started up).

- It installs ember-cli-fastboot, runs `ember fastboot`, then waits for
  the command to either exit or hit the timeout (Default 30s). Hitting
the timeout means the command has succeeded in starting up a server, so
this timeout may need to be adjusted longer for apps or addons with long
build times.
@rwjblue
Copy link
Member

rwjblue commented Feb 6, 2016

Much of this PR is great!

I'd rather see the ability to allow the scenario to define its own default command though. This is now possible (since bower and npm are keys on the main scenario config):

module.exports = {
  command: 'ember test',  // this is the default command for all scenarios in this file, and if not present we default to `ember test`
  scenarios: [
    {
      name: 'fastboot',
      command: 'ember fastboot',  // this is the command for this individual scenario
      timeout: { time: 30000, considerTimeoutSuccess: true },
      npm: {
        'ember-cli-fastboot': '^9.9.9'
      }
    }
  ]
};

Making these changes makes all of our commands much better (ember try, ember try:testall, etc), and enables the functionality needed for ember try:fastboot without requiring the super customized command.

Also, to give out of the box fastboot testing support to ember-cli addons, we would add the above fastboot scenario to the default config/ember-try.js.

What do you think?

@kategengler
Copy link
Member Author

I agree re: being able to add a custom command, and that was in my first approach, but I want more time to work on that. I want to support multiple commands, and commands that aren't ember, which requires some refactoring.

Since I was asked for ember try:fastboot, I figured something is better than nothing.

@tomdale
Copy link

tomdale commented Feb 8, 2016

@kategengler One thing I've seen us do in automated tests is examine output to stdout and looking for messages indicating the server has started. That should significantly reduce the time required for small apps since you don't have to wait for the timeout, and means you can increase the default timeout for larger apps since hitting the timeout would be exceptional, rather than part of the normal part of testing.

(See https://github.com/tomdale/ember-cli-addon-tests/blob/master/lib/commands/start-server.js#L55-L66 for an example implementation.)

@rwjblue's plan sounds awesome but I'm not yet familiar enough with ember-try's internals to have a strong opinion. This seems fine as an MVP to me. I don't think the refactor Robert suggested affects the "public API" (ember try:fastboot) so there's no harm in getting this out then cleaning it up later, if I'm understanding correctly.

@kategengler
Copy link
Member Author

@tomdale I think @rwjblue's suggestion was to have a general way of running other commands, and so in that scenario we wouldn't have an ember try:fastboot.

I thought about examining stdout but it seemed risky to rely on the output of another addon. If that output really won't change, then we could do that.

Another thought I had is that maybe the ember-cli-fastboot addon should provide its own ember fastboot:test that would exit successfully if the server started up, that way it could own its own definition of what success is, and then ember-try can just be used to run it as a scenario ala what @rwjblue suggested (or with its own command as a convenience).

@tomdale
Copy link

tomdale commented Feb 11, 2016

@kategengler The idea for ember fastboot:test is a great one. I can work on it but would love your help if you have spare cycles.

@tomdale
Copy link

tomdale commented Mar 1, 2016

@kategengler What's the status on this? 😊

@kategengler
Copy link
Member Author

@tomdale Still want to add ember fastboot:test to ember-cli-fastboot. Was on vacation and now blocked by tomdale/ember-cli-addon-tests#2

@tomdale
Copy link

tomdale commented Mar 14, 2016

@kategengler Cut v0.2.1 of ember-cli-addon-tests that should hopefully resolve the issue.

@tomdale
Copy link

tomdale commented Mar 21, 2016

@kategengler Were you able to verify if that fixed the issue?

@kategengler
Copy link
Member Author

I haven't been able to get back to it yet, unfortunately.

On Mon, Mar 21, 2016 at 11:54 AM, Tom Dale notifications@github.com wrote:

@kategengler https://github.com/kategengler Were you able to verify if
that fixed the issue?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#53 (comment)

@tomdale
Copy link

tomdale commented May 4, 2016

@kategengler Gentle nudge. ;)

@simonihmig
Copy link

Just stumbled upon this... I have put this thing together recently: https://github.com/kaliber5/ember-fastboot-addon-tests

It lets you test your addon in Fastboot. Not only spins up the server, but also lets you write custom tests that make a request and run custom assertions against the response. Also provides a ember fastboot:test command.

I guess this could be integrated with an ember-try scenario using the approach suggested by @rwjblue. If there is anything else that could help making these play together nicely, I am more than willing to do my part here! :)

@Turbo87
Copy link
Member

Turbo87 commented Dec 20, 2018

closing due to inactivity and plenty of conflicts

@Turbo87 Turbo87 closed this Dec 20, 2018
@Turbo87 Turbo87 deleted the kg-ember-try-fastboot branch December 20, 2018 19:08
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.

5 participants