getgauge / gauge-csharp

Csharp runner for Gauge
https://gauge.org
GNU General Public License v3.0
33 stars 21 forks source link

Unable to run tests #159

Closed jspenc72 closed 5 years ago

jspenc72 commented 5 years ago

Expected behavior

Tests should begin to execute.

Actual behavior

Tests failed to start and the following output is shown

Error ----------------------------------

Failed to start gauge API: Timed out connecting to 127.0.0.1:58435

Get Support ----------------------------
    Docs:          https://docs.gauge.org
    Bugs:          https://github.com/getgauge/gauge/issues
    Chat:          https://gitter.im/getgauge/chat

Your Environment Information -----------
    darwin, 1.0.4, 3a9a647
    csharp (0.10.5), html-report (4.0.8), screenshot (0.0.1), xml-report (0.2.1)

Steps to reproduce

  1. Create a new directory.
  2. touch ./Dockerfile
    
    FROM centos:7

WORKDIR /gauge

USER root RUN yum install -y unzip

RUN \ wget -O /tmp/gauge.zip curl -s https://api.github.com/repos/getgauge/gauge/releases | grep browser_download_url | grep 'linux.x86_64.zip' | head -n 1 | cut -d '"' -f 4 && \ unzip -d /tmp/gauge /tmp/gauge.zip RUN ls -la /tmp/ RUN ls -la /tmp/gauge RUN ls -la /tmp/gauge/gauge RUN \ cp /tmp/gauge/gauge /usr/local/bin/ && \

http://www.mono-project.com/download/#download-lin-centos

yum install yum-utils

RUN \ rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" && \ yum-config-manager --add-repo http://download.mono-project.com/repo/centos7/

RUN \ yum install -y mono-devel

RUN \ yum remove -y yum-utils && \ yum clean all && \ rm -rf gauge gauge.zip ~/.gauge/config ~/.gauge/logs &&\ chmod 777 /gauge

RUN \ yum install -y nuget

ENV GAUGE_HOME=/gauge/plugins ENV GAUGE_API_PORT=36267 ENV GAUGE_INTERNAL_PORT=36165

RUN env

Install gauge plugins

RUN gauge install java && \ gauge install screenshot RUN gauge install csharp RUN gauge install html-report RUN gauge install xml-report

RUN chmod 777 /gauge/plugins -R

Add test framework source code

COPY . /ngs/testing WORKDIR /ngs/testing

RUN ls -la

Install nuget dependencies

RUN nuget update -self RUN nuget restore -MSBuildVersion 14

RUN gauge run specs/ReactVariantTable.spec

ENV PATH=$HOME/.gauge:$PATH

3. docker build -t gauge-centos .
4. touch docker-compose.yaml
```yaml
version: '3.3'
services:
  ngs_web_testing:
    # build context uses the main dockerfile and targets the test
    image: gauge-centos
    user: root
    entrypoint: 
      - gauge 
      - run 
      - --verbose
      - specs
  1. docker-compose up

Gauge version

Gauge version: 1.0.4
Commit Hash: 3a9a647

Plugins
-------
csharp (0.10.5)
html-report (4.0.8)
screenshot (0.0.1)
xml-report (0.2.1)

Project Recent Gauge Log Output

19:48:03.962 Compatible version of plugin csharp not found. Installing plugin csharp...
19:48:03.965 Gathering metadata for csharp
19:48:04.534 Downloading gauge-csharp-0.10.5.zip
19:48:08.566 Running plugin hook command => [chmod +x run.sh]
19:48:08.568 Installing plugin csharp 0.10.5
19:48:08.635 Successfully installed plugin 'csharp'.
19:48:08.636 Compatible version of plugin html-report not found. Installing plugin html-report...
19:48:08.636 Gathering metadata for html-report
19:48:08.862 Downloading html-report-4.0.6-linux.x86_64.zip
19:48:09.695 Installing plugin html-report 4.0.6
19:48:09.715 Successfully installed plugin 'html-report'.
19:48:09.716 Compatible version of plugin xml-report not found. Installing plugin xml-report...
19:48:09.717 Gathering metadata for xml-report
19:48:09.842 Downloading xml-report-0.2.1-linux.x86_64.zip
19:48:10.556 Installing plugin xml-report 0.2.1
19:48:10.569 Successfully installed plugin 'xml-report'.
19:48:10.641 Checking updates...
19:48:10.693 Runner connection error: Runner with pid 21 quit unexpectedly(exit status 127).
19:48:10.693 Error while killing runner: os: process already finished
19:48:10.694 Failed to start gauge API: Runner with pid 21 quit unexpectedly(exit status 127).
19:48:15.807 Compatible version of plugin csharp not found. Installing plugin csharp...
19:48:15.809 Gathering metadata for csharp
19:48:16.135 Downloading gauge-csharp-0.10.5.zip
19:48:19.350 Running plugin hook command => [chmod +x run.sh]
19:48:19.353 Installing plugin csharp 0.10.5
19:48:19.434 Successfully installed plugin 'csharp'.
19:48:19.436 Compatible version of plugin html-report not found. Installing plugin html-report...
19:48:19.436 Gathering metadata for html-report
19:48:19.538 Downloading html-report-4.0.6-linux.x86_64.zip
19:48:20.364 Installing plugin html-report 4.0.6
19:48:20.388 Successfully installed plugin 'html-report'.
19:48:20.389 Compatible version of plugin xml-report not found. Installing plugin xml-report...
19:48:20.389 Gathering metadata for xml-report
19:48:20.485 Downloading xml-report-0.2.1-linux.x86_64.zip
19:48:21.112 Installing plugin xml-report 0.2.1
19:48:21.124 Successfully installed plugin 'xml-report'.
19:48:21.223 Checking updates...
19:48:21.263 Runner connection error: Runner with pid 21 quit unexpectedly(exit status 127).
19:48:21.263 Error while killing runner: os: process already finished
19:48:21.264 Failed to start gauge API: Runner with pid 21 quit unexpectedly(exit status 127).
19:49:33.782 Plugin csharp is already installed.
19:49:33.785 Compatible version of plugin html-report not found. Installing plugin html-report...
19:49:33.786 Gathering metadata for html-report
19:49:34.109 Downloading html-report-4.0.6-linux.x86_64.zip
19:49:35.776 Installing plugin html-report 4.0.6
19:49:35.796 Successfully installed plugin 'html-report'.
19:49:35.796 Compatible version of plugin xml-report not found. Installing plugin xml-report...
19:49:35.797 Gathering metadata for xml-report
19:49:35.891 Downloading xml-report-0.2.1-linux.x86_64.zip
19:49:36.550 Installing plugin xml-report 0.2.1
19:49:36.563 Successfully installed plugin 'xml-report'.
19:49:36.635 Checking updates...
19:49:36.745 Runner connection error: Runner with pid 20 quit unexpectedly(exit status 127).
19:49:36.745 Error while killing runner: os: process already finished
19:49:36.746 Failed to start gauge API: Runner with pid 20 quit unexpectedly(exit status 127).
19:50:13.490 Plugin html-report is already installed.
19:50:13.493 Plugin xml-report is already installed.
19:50:13.493 Plugin csharp is already installed.
19:50:13.618 Runner connection error: Runner with pid 17 quit unexpectedly(exit status 127).
19:50:13.618 Error while killing runner: os: process already finished
19:50:13.618 Failed to start gauge API: Runner with pid 17 quit unexpectedly(exit status 127).
19:52:04.812 Plugin csharp is already installed.
19:52:04.814 Plugin html-report is already installed.
19:52:04.815 Plugin xml-report is already installed.
19:52:04.921 Runner connection error: Runner with pid 18 quit unexpectedly(exit status 127).
19:52:04.921 Error while killing runner: os: process already finished
19:52:04.921 Failed to start gauge API: Runner with pid 18 quit unexpectedly(exit status 127).
20:02:54.601 Plugin csharp is already installed.
20:02:54.603 Plugin html-report is already installed.
20:02:54.603 Plugin xml-report is already installed.
20:02:54.928 Checking updates...
C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
20:03:24.685 Runner connection error: Timed out connecting to 127.0.0.1:35753
20:03:24.686 Error while killing runner: os: process already finished
20:03:24.688 Failed to start gauge API: Timed out connecting to 127.0.0.1:35753
10:32:37.423 Compatible version of plugin csharp not found. Installing plugin csharp...
10:32:37.423 Gathering metadata for csharp
10:32:37.903 Downloading gauge-csharp-0.10.5.zip
10:32:40.688 Running plugin hook command => [chmod +x run.sh]
10:32:40.692 Installing plugin csharp 0.10.5
10:32:40.801 Successfully installed plugin 'csharp'.
10:32:40.802 Compatible version of plugin html-report not found. Installing plugin html-report...
10:32:40.802 Gathering metadata for html-report
10:32:40.885 Downloading html-report-4.0.8-darwin.x86_64.zip
10:32:41.563 Installing plugin html-report 4.0.8
10:32:41.595 Successfully installed plugin 'html-report'.
10:32:41.595 Compatible version of plugin xml-report not found. Installing plugin xml-report...
10:32:41.595 Gathering metadata for xml-report
10:32:41.680 Downloading xml-report-0.2.1-darwin.x86_64.zip
10:32:42.329 Installing plugin xml-report 0.2.1
10:32:42.344 Successfully installed plugin 'xml-report'.
10:32:42.345 Installing required plugins.
10:32:42.345 Installing plugin 'screenshot'
10:32:42.345 Gathering metadata for screenshot
10:32:42.426 Downloading screenshot-0.0.1-darwin.x86_64.zip
10:32:42.479 Checking updates...
10:32:42.729 Installing plugin screenshot 0.0.1
10:32:42.732 Successfully installed plugin 'screenshot'.
10:32:42.758 Runner connection error: Runner with pid 26940 quit unexpectedly(exit status 127).
10:32:42.758 Error while killing runner: os: process already finished
10:32:42.758 Failed to start gauge API: Runner with pid 26940 quit unexpectedly(exit status 127).
10:37:39.061 Plugin csharp is already installed.
10:37:39.062 Plugin html-report is already installed.
10:37:39.063 Plugin xml-report is already installed.
10:37:39.084 Runner connection error: Runner with pid 27769 quit unexpectedly(exit status 127).
10:37:39.084 Error while killing runner: os: process already finished
10:37:39.084 Failed to start gauge API: Runner with pid 27769 quit unexpectedly(exit status 127).
10:37:59.382 Plugin csharp is already installed.
10:37:59.383 Plugin html-report is already installed.
10:37:59.383 Plugin xml-report is already installed.
10:37:59.878 Checking updates...
C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
10:38:29.396 Runner connection error: Timed out connecting to 127.0.0.1:62123
10:38:29.397 Error while killing runner: os: process already finished
10:38:29.397 Failed to start gauge API: Timed out connecting to 127.0.0.1:62123
10:40:35.382 Plugin html-report is already installed.
10:40:35.383 Plugin xml-report is already installed.
10:40:35.384 Plugin csharp is already installed.
10:40:35.841 Checking updates...
Unable to create Sandbox in /gauge_bin
The version of Gauge.CSharp.Lib in the project is incompatible with the version of Gauge CSharp plugin.
 Expecting minimum version: 0.7.2, found 0.7.1.0.
Ensure latest version is used in your project. If you are using Nuget, try updating your dependencies.
10:41:05.409 Runner connection error: Timed out connecting to 127.0.0.1:62346
10:41:05.409 Error while killing runner: os: process already finished
10:41:05.409 Failed to start gauge API: Timed out connecting to 127.0.0.1:62346
10:42:28.487 Plugin csharp is already installed.
10:42:28.488 Plugin html-report is already installed.
10:42:28.488 Plugin xml-report is already installed.
10:42:28.977 Checking updates...
C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
10:42:58.508 Runner connection error: Timed out connecting to 127.0.0.1:62366
10:42:58.508 Error while killing runner: os: process already finished
10:42:58.508 Failed to start gauge API: Timed out connecting to 127.0.0.1:62366
10:43:25.433 Plugin xml-report is already installed.
10:43:25.433 Plugin csharp is already installed.
10:43:25.433 Plugin html-report is already installed.
10:43:25.849 Checking updates...
C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
10:43:55.449 Runner connection error: Timed out connecting to 127.0.0.1:62376
10:43:55.450 Error while killing runner: os: process already finished
10:43:55.450 Failed to start gauge API: Timed out connecting to 127.0.0.1:62376
10:55:44.774 Plugin csharp is already installed.
10:55:44.776 Plugin html-report is already installed.
10:55:44.776 Plugin xml-report is already installed.
10:55:45.227 Checking updates...
C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
10:56:14.807 Runner connection error: Timed out connecting to 127.0.0.1:62912
10:56:14.807 Error while killing runner: os: process already finished
10:56:14.808 Failed to start gauge API: Timed out connecting to 127.0.0.1:62912
14:06:33.196 Plugin csharp is already installed.
14:06:33.199 Plugin html-report is already installed.
14:06:33.200 Plugin xml-report is already installed.
14:06:33.774 Checking updates...
C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
14:07:03.243 Runner connection error: Timed out connecting to 127.0.0.1:65016
14:07:03.244 Error while killing runner: os: process already finished
14:07:03.244 Failed to start gauge API: Timed out connecting to 127.0.0.1:65016
14:08:19.701 Plugin csharp is already installed.
14:08:19.702 Plugin html-report is already installed.
14:08:19.702 Plugin xml-report is already installed.
14:08:20.241 Checking updates...
C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
14:08:49.733 Runner connection error: Timed out connecting to 127.0.0.1:65037
14:08:49.734 Error while killing runner: os: process already finished
14:08:49.735 Failed to start gauge API: Timed out connecting to 127.0.0.1:65037
14:11:15.990 Plugin csharp is already installed.
14:11:15.990 Plugin html-report is already installed.
14:11:15.991 Plugin xml-report is already installed.
14:11:16.482 Checking updates...
C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
14:11:46.028 Runner connection error: Timed out connecting to 127.0.0.1:65052
14:11:46.028 Error while killing runner: os: process already finished
14:11:46.029 Failed to start gauge API: Timed out connecting to 127.0.0.1:65052
08:00:38.501 Plugin csharp is already installed.
08:00:38.502 Plugin html-report is already installed.
08:00:38.503 Plugin xml-report is already installed.
08:00:39.000 Checking updates...
C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
08:01:08.536 Runner connection error: Timed out connecting to 127.0.0.1:50826
08:01:08.537 Error while killing runner: os: process already finished
08:01:08.537 Failed to start gauge API: Timed out connecting to 127.0.0.1:50826
13:27:13.892 Plugin xml-report is already installed.
13:27:13.893 Plugin csharp is already installed.
13:27:13.894 Plugin html-report is already installed.
13:27:14.580 Checking updates...
C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
13:27:43.942 Runner connection error: Timed out connecting to 127.0.0.1:58435
13:27:43.942 Error while killing runner: os: process already finished
13:27:43.943 Failed to start gauge API: Timed out connecting to 127.0.0.1:58435
sriv commented 5 years ago

Hi @jspenc72 - I had to modify your Dockerfile slightly, since it assumes your test code directory in it.

Here's what I did:

FROM centos:7

WORKDIR /gauge

USER root
RUN yum install -y unzip wget

RUN \
  wget -O /tmp/gauge.zip `curl -s https://api.github.com/repos/getgauge/gauge/releases | grep browser_download_url | grep 'linux.x86_64.zip' | head -n 1 | cut -d '"' -f 4` && \
  unzip -d /tmp/gauge /tmp/gauge.zip
RUN ls -la /tmp/ 
RUN ls -la /tmp/gauge
RUN  ls -la /tmp/gauge/gauge
RUN \
  cp /tmp/gauge/gauge /usr/local/bin/ && \
  # http://www.mono-project.com/download/#download-lin-centos
  yum install yum-utils

RUN \
  rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" && \
  yum-config-manager --add-repo http://download.mono-project.com/repo/centos7/

RUN  \ 
  yum install -y mono-devel

RUN \
  yum remove -y yum-utils && \
  yum clean all && \
  rm -rf gauge gauge.zip ~/.gauge/config ~/.gauge/logs &&\
  chmod 777 /gauge

RUN \ 
  yum install -y nuget

ENV GAUGE_HOME=/gauge/plugins
ENV GAUGE_API_PORT=36267
ENV GAUGE_INTERNAL_PORT=36165

RUN env

# Install gauge plugins
RUN gauge install java && \
  gauge install screenshot
RUN gauge install csharp
RUN gauge install html-report
RUN gauge install xml-report

RUN chmod 777 /gauge/plugins -R

CMD gauge init csharp && gauge run specs

and after docker build -t gauge-centos . I ran docker run -t gauge-centos. Here's the output:

 create  gauge
 create  gauge
 create  gauge
 create  Properties/AssemblyInfo.cs
 create  env/default/csharp.properties
 create  StepImplementation.cs
 create  packages.config
 create  gauge.csproj
 create  gauge.sln
 Installing Nuget Package : FluentAssertions, version: 3.5.0
 Installing Nuget Package : Gauge.CSharp.Lib, version: 0.7.2
 Done Installing Nuget Package!
 create  manifest.json
 create  specs
 create  specs/example.spec
 create  .gitignore
 create  env
 create  env/default
 create  env/default/default.properties
Successfully initialized the project. Run specifications with "gauge run specs/".

Telemetry
---------

This installation of Gauge collects usage data in order to help us improve your experience.
The data is anonymous and doesn't include command-line arguments.
To turn this message off opt in or out by running 'gauge telemetry on' or 'gauge telemetry off'.

Read more about Gauge telemetry at https://gauge.org/telemetry

Building project: /gauge/gauge.csproj
  /usr/bin/xbuild  /gauge/gauge.csproj /t:Build  /v:q    /p:RestorePackages="False" /p:OutputPath="/gauge/gauge_bin" /p:Platform="Any CPU" /p:Configuration="Debug" /logger:Fake.MsBuildLogger+ErrorLogger,"/gauge/plugins/plugins/csharp/0.10.5/bin/FakeLib.dll"

>>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<

XBuild Engine Version 14.0
Mono, Version 5.18.1.0
Copyright (C) 2005-2013 Various Mono authors
# Specification Heading
  ## Vowel counts in single word     ✔ ✔
  ## Vowel counts in multiple word   ✔ ✔

Successfully generated html-report to => /gauge/reports/html-report/index.html
Specifications: 1 executed  1 passed    0 failed    0 skipped
Scenarios:  2 executed  2 passed    0 failed    0 skipped

Total time taken: 1.832s

Telemetry
---------

This installation of Gauge collects usage data in order to help us improve your experience.
The data is anonymous and doesn't include command-line arguments.
To turn this message off opt in or out by running 'gauge telemetry on' or 'gauge telemetry off'.

Read more about Gauge telemetry at https://gauge.org/telemetry

For your case I suspect that your project somehow has a build error, it's indicated in your log by this line:

C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.

Could you try building your project in the container and check? for ex, you could /bin/bash into your container instance and run gauge run specs?

jspenc72 commented 5 years ago

@sriv Ok so I was able to reproduce the behavior im getting with a newly created project by doing the following:

  1. mkdir ./projectdir && cd ./projectdir
  2. gauge init
  3. gauge run specs (Tests pass)
    
    $ gauge run specs
    Building project: /ngs-tests/NgsTests.csproj
    /Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild  /ngs-tests/NgsTests.csproj /t:Build  /v:q    /p:RestorePackages="False" /p:OutputPath="/ngs-tests/gauge_bin" /p:Platform="Any CPU" /p:Configuration="Debug" /logger:Fake.MsBuildLogger+ErrorLogger,"/.gauge/plugins/csharp/0.10.5/bin/FakeLib.dll"
    Microsoft (R) Build Engine version 16.0.40-preview+ge6c3a1f9e4 for Mono
    Copyright (C) Microsoft Corporation. All rights reserved.

Specification Heading

Vowel counts in single word ✔ ✔

Vowel counts in multiple word ✔ ✔

Successfully generated html-report to => /ngs-tests/reports/html-report/index.html Specifications: 1 executed 1 passed 0 failed 0 skipped Scenarios: 2 executed 2 passed 0 failed 0 skipped

Total time taken: 273ms

Telemetry

This installation of Gauge collects usage data in order to help us improve your experience. The data is anonymous and doesn't include command-line arguments. To turn this message off opt in or out by running 'gauge telemetry on' or 'gauge telemetry off'.

Read more about Gauge telemetry at https://gauge.org/telemetry


4. `cd ../`
5. `mkdir ./otherdir`
6. `mv ./projectdir/* ./otherdir/ && cd ./otherdir`
7.  `gauge run specs` (Tests fail, Plugin fails to start)

```bash
$ gauge run specs
Building project: /ngs-tests/NgsTests.csproj
  /Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild  /ngs-tests/NgsTests.csproj /t:Build  /v:q    /p:RestorePackages="False" /p:OutputPath="/ngs-tests/gauge_bin" /p:Platform="Any CPU" /p:Configuration="Debug" /logger:Fake.MsBuildLogger+ErrorLogger,"/.gauge/plugins/csharp/0.10.5/bin/FakeLib.dll"
Microsoft (R) Build Engine version 16.0.40-preview+ge6c3a1f9e4 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1009: Project file does not exist.
Switch: /ngs-tests/NgsTests.csproj
Gauge.CSharp.Runner.GaugeProjectBuilder C# Project build failed Exception of type 'Fake.MSBuildHelper+BuildException' was thrown.
Error ----------------------------------

Failed to start gauge API: Timed out connecting to 127.0.0.1:60515

Get Support ----------------------------
    Docs:          https://docs.gauge.org
    Bugs:          https://github.com/getgauge/gauge/issues
    Chat:          https://gitter.im/getgauge/chat

Your Environment Information -----------
    darwin, 1.0.4, 3a9a647
    csharp (0.10.5), html-report (4.0.8), screenshot (0.0.1), xml-report (0.2.1)
BugDiver commented 5 years ago

@jspenc72 This issue is related to #154. The csharp.properties file in env dir contains a hardcoded path when you create the project When you move the project the path for project file changes and the gauge-csharp runner fails to find it.

This issue has been already fixed, we will be making a release soon with the fix. Meanwhile, you can use the nightly version of gauge-csharp runner( you can find it https://bintray.com/gauge/gauge-csharp). Refer https://github.com/getgauge/gauge-csharp#nightly-installation to check the nightly install instructions.

If you do not want to use the nightly you can update the GAUGE_CSHARP_PROJECT_FILE property in env/csharp.properties file to use the relative project after creating the project.

jspenc72 commented 5 years ago

Thank you! It appears that there were two separate issues. The properties file May not be the same problem.

BugDiver commented 5 years ago

@jspenc72 I could not replicate your original issue with the updated Dockerfile by @sriv (After fixing the properties I was able to run the specs).

mattg-vbt commented 5 years ago

I don't see why an incorrect properties file caused the error message "Failed to start gauge API: Timed out connecting to 127.0.0.1:58435." Did it really time out connecting to that port? Was that the wrong port?

NivedhaSenthil commented 5 years ago

It is currently happening because the cSharp runner crashes as the project path is wrong and hence Gauge could not connect to it. Perhaps the error message can be more evident.

Debashis9012 commented 5 years ago

This issue has been verified and found fixed with the version 0.10.6.nightly-2019-05-16