cloudfoundry / staticfile-buildpack

Deploy static HTML/JS/CSS apps to Cloud Foundry
Apache License 2.0
201 stars 326 forks source link

Failed to execute "a staticfile app with no staticfile should be running" #110

Closed kanekoh closed 7 years ago

kanekoh commented 7 years ago

What version of Cloud Foundry and CF CLI are you using? (i.e. What is the output of running cf curl /v2/info && cf version?

I use CF v254 + Diego v1.10.1 and cli version 6.26

The result of cf curl /v2/info ( made URL dummy...)

$ cf curl /v2/info
{
   "name": "CF",
   "build": "6cc676805aba9560d1de0aa3be93b55f958e5f54",
   "support": "XXXXX",
   "version": 2,
   "description": "CF",
   "authorization_endpoint": "XXXXX",
   "token_endpoint": "https://XXXXX",
   "min_cli_version": "6.26.0",
   "min_recommended_cli_version": "6.26.0",
   "api_version": "2.77.0",
   "app_ssh_endpoint": "XXX:2222",
   "app_ssh_host_key_fingerprint": null,
   "app_ssh_oauth_client": "ssh-proxy",
   "logging_endpoint": "wss://XXXX:443",
   "doppler_logging_endpoint": "XXXXX:443"
}

The result of cf version

$ cf version
cf version 6.26.0+9c9a261.2017-04-06

What version of the buildpack you are using?

staticfile v1.4.11

If you were attempting to accomplish a task, what was it you were attempting to do?

Execute integration tests for buildpack as follows BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-build --delete-space-on-exit --no-upload --host=bosh-lite.com

What did you expect to happen?

All tests pass.

What was the actual behavior?

I got an error as follows:

  1) a staticfile app with no staticfile should be running
     Failure/Error: expect(app).to be_running

       App is not running. Logs are:
       Using manifest file /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/manifest.yml

       Using stack cflinuxfs2...
       OK
       Creating app without_staticfile in org pivotal / space integration-staticfile-1501474684 as release-802efa6b-532e-48ec-9c0c-b956d01b6e79...
       FAILED
       Server error, status code: 400, error code: 100001, message: The app is invalid: buildpack staticfile-test-buildpack is not valid public url or a known buildpack name
       Retrieving logs for app without_staticfile in org pivotal / space integration-staticfile-1501474684 as release-802efa6b-532e-48ec-9c0c-b956d01b6e79...

       FAILED
     # ./cf_spec/integration/deploy_a_staticfile_app_missing_staticfile_spec.rb:13:in `block (2 levels) in <top (required)>'

The cause is I didn't upload the buildpack name with 'staticfile-test-buildpack'. Is there any reason to specify 'staticfile-test-buildpack' as buildpack name?

Please confirm where necessary:

cf-gitbot commented 7 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/149792900

The labels on this github issue will be updated when the story is started.

sclevine commented 7 years ago

I believe this is due to how our Concourse CI/CD system runs these tests. @dgodd may be able to provide more info.

dgodd commented 7 years ago

We have just changed our integration test framework for the staticfile buildpack to make it easier and faster to run. The new test suite is on the develop branch. It would be interesting to know if you have any problems with it @kanekoh ?

kanekoh commented 7 years ago

I tried to execute the integration tests on the develop branch in my environment and got the error as follows:

 ~ Failure in Spec Setup (BeforeEach) [61.845 seconds]
 deploy a staticfile app
 /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/deploy_reverse_proxy_app_test.go:29
   proxies [BeforeEach]
   /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/deploy_reverse_proxy_app_test.go:28

   Timed out after 10.193s.
   Error: Unexpected non-nil/non-zero extra argument at index 1:
    <*errors.errorString>: &errors.errorString{s:"Expected one app, found 0"}

   /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integr

Am I missing somthing?

BTW, I'd like to specify the flag like 'version', 'cached' when exectuing integration tests.

dgodd commented 7 years ago

If you check scripts/integration it should show you how to specify cached true/false. There is also a version flag which stops the tests from creating and uploading a buildpack and tests against the existing one

Was it a single test that failed? Or all of them?

kanekoh commented 7 years ago

All of them failed with the above error. The application looks running on CF v254 + Diego v1.10.1.

name:              cutlass-fixture-copy429088257-jjpjzpfrfegmotafeths
requested state:   started
instances:         1/1
usage:             128M x 1 instances
routes:            cutlass-fixture-copy429088257-jjpjzpfrfegmotafeths.jp-west-1.cf-app.net
last uploaded:     Wed 02 Aug 23:30:15 UTC 2017
stack:             cflinuxfs2
buildpack:         staticfile 1.4.11
start command:     $HOME/boot.sh

     state     since                  cpu    memory         disk           details
#0   running   2017-08-02T23:30:39Z   0.0%   2.4M of 128M   7.2M of 128M   
Deleting app cutlass-fixture-copy429088257-jjpjzpfrfegmotafeths in org pivotal / space integration-staticfile-1501485255 as release-802efa6b-532e-48ec-9c0c-b956d01b6e79
OK

~ Failure in Spec Setup (JustBeforeEach) [36.418 seconds]
deploy a an app with dot files
/home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/deploy_app_with_dotfiles_test.go:89
  host_dot_files: true is present in Staticfile [JustBeforeEach]
  /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/deploy_app_with_dotfiles_test.go:65
    the app uses the default root location
    /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/deploy_app_with_dotfiles_test.go:54
      hosts the dotfiles
      /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/deploy_app_with_dotfiles_test.go:53

      Timed out after 10.087s.
      Error: Unexpected non-nil/non-zero extra argument at index 1:
        <*errors.errorString>: &errors.errorString{s:"Expected one app, found 0"}

      /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/integration_suite_test.go:40
------------------------------
dgodd commented 7 years ago

That looks to me like it failed waiting for the app to push. Could you please try increasing the timeout on the following line

https://github.com/cloudfoundry/staticfile-buildpack/blob/develop/src/staticfile/integration/integration_suite_test.go#L40

and tell me if it works. If it does, I will increase the timeout (or if you would like to send a PR)

On Thu, Aug 3, 2017 at 7:27 PM Hiroyuki Kaneko notifications@github.com wrote:

All of them failed with the above error. The application looks running on CF v254 + Diego v1.10.1.

name: cutlass-fixture-copy429088257-jjpjzpfrfegmotafeths requested state: started instances: 1/1 usage: 128M x 1 instances routes: cutlass-fixture-copy429088257-jjpjzpfrfegmotafeths.jp-west-1.cf-app.net last uploaded: Wed 02 Aug 23:30:15 UTC 2017 stack: cflinuxfs2 buildpack: staticfile 1.4.11 start command: $HOME/boot.sh

 state     since                  cpu    memory         disk           details

0 running 2017-08-02T23:30:39Z 0.0% 2.4M of 128M 7.2M of 128M

Deleting app cutlass-fixture-copy429088257-jjpjzpfrfegmotafeths in org pivotal / space integration-staticfile-1501485255 as release-802efa6b-532e-48ec-9c0c-b956d01b6e79 OK

~ Failure in Spec Setup (JustBeforeEach) [36.418 seconds] deploy a an app with dot files /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/deploy_app_with_dotfiles_test.go:89 host_dot_files: true is present in Staticfile [JustBeforeEach] /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/deploy_app_with_dotfiles_test.go:65 the app uses the default root location /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/deploy_app_with_dotfiles_test.go:54 hosts the dotfiles /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/deploy_app_with_dotfiles_test.go:53

  Timed out after 10.087s.
  Error: Unexpected non-nil/non-zero extra argument at index 1:
      <*errors.errorString>: &errors.errorString{s:"Expected one app, found 0"}

  /home/cloud-user/kaneko_work/buildpack-tests/staticfile-buildpack/src/staticfile/integration/integration_suite_test.go:40

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cloudfoundry/staticfile-buildpack/issues/110#issuecomment-320116391, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHtTUd_3m4HDrz-hgCWx7lVo1DTALi4ks5sUldHgaJpZM4On8XG .

kanekoh commented 7 years ago

@dgodd, the cause of issue is that I specified the CF_HOME environment variable while executing the tests however still it has failure cases so I need time to investigate them.

dgodd commented 7 years ago

@kanekoh I don't understand how setting CF_HOME on your machine should cause problems. Could you please explain so I can at the least help others in the future.

Did you try increasing the timeout? Did it help?

kanekoh commented 7 years ago

@dgodd , i tried increasing the timeout but it didn't help for me. The cause is libbuildpack get a space guid from .cf/config.json file with HOME environment. I specified CF_HOME so my .cf/config.json file was at $CF_HOME/.cf/config.json but not at $HOME/.cf/config.json.

sclevine commented 7 years ago

@dgodd I definitely agree that we shouldn't be parsing the CLI config here: https://github.com/cloudfoundry/libbuildpack/blob/master/cutlass/cf.go#L157

dgodd commented 7 years ago

@slevine I'm open to alternatives. Unfortunately as far as I am aware, it isn't possible to get it from the cli.

kanekoh commented 7 years ago

@dgodd , How about using the cf command with --guid option as follows? I've asked cli PM the best way to get space guid from cf cli command. .cf/config.json is internal file for cf cli so it's not good way to parse that file.

And we can get targeted space name with cf target command without any arguments.

$ cf space pivotal --guid
a95adf85-e3f3-4e8b-9371-40dd7c828593
dgodd commented 7 years ago

@sclevine @kanekoh I was about to try this. Unfortunately cf space pivotal --guid means I need to know the currrent space and cf target doesn't accept guid. Unless anyone has other suggestions, I am going to use $CF_HOME or ~/.cf/

sclevine commented 7 years ago

We should not rely on internal implementation details of the cf CLI to obtain the current space GUID.

The current space can be determined with the cf target command. To get the current space GUID (in bash), one could do:

cf space "$(cf target|awk '/^space:/ { sub("space:[ \t]*", "", $0); print }')" --guid
dgodd commented 7 years ago

@sclevine We have done such things in the past, I have found that the textual output changes more frequently than the config file on disk. I personally feel that the disk json/yaml representation is a a safer detail than parsing human readable text. (My preferred option of course would be that the cli output machine output, eg. json or the --guid flag)

sclevine commented 7 years ago

Do we control the name of the space? Can the space name be provided by the user running the text somehow?

I would strongly prefer to avoid relying on implementation details of the CLI.

dgodd commented 7 years ago

@sclevine We could force users to specify the space when they run ginkgo, but I would rather not, it makes things much more annoying

sclevine commented 7 years ago

Closing this as the tests now respect CF_HOME.