Code Monkey home page Code Monkey logo

Comments (13)

serinth avatar serinth commented on August 31, 2024 1

I just pulled from master and ran the 0.0.3 release for windows. The following are the logs:

from Pact Daemon:

$ ./pact-go_windows_386.exe daemon -v -l DEBUG
2017/02/23 09:04:26 [DEBUG] setting up a service manager
2017/02/23 09:04:26 [DEBUG] setting up a service manager
2017/02/23 09:04:26 [DEBUG] setting up a service manager
2017/02/23 09:04:26 [DEBUG] setting up a service manager
2017/02/23 09:04:26 [INFO] daemon - starting daemon on network: tcp address:  port: 6666
2017/02/23 09:04:26 method Shutdown has wrong number of ins: 1
2017/02/23 09:04:26 [DEBUG] starting service removal monitor
2017/02/23 09:04:26 method StartDaemon has wrong number of ins: 4
2017/02/23 09:04:26 [DEBUG] starting service creation monitor
2017/02/23 09:04:26 [DEBUG] starting service creation monitor
2017/02/23 09:04:26 [DEBUG] starting service removal monitor
2017/02/23 09:04:26 [DEBUG] starting service creation monitor
2017/02/23 09:04:26 [DEBUG] starting service creation monitor
2017/02/23 09:04:26 [DEBUG] starting service removal monitor
2017/02/23 09:04:26 [DEBUG] starting service removal monitor
2017/02/23 09:04:30 [DEBUG] daemon - starting mock server with args: [--pact-specification-version 2 --pact-dir C:\MYPATH\Projects\Go\src\github.com\pact-foundation\pact-go\examples\pacts --log C:\MYPATH\Projects\Go\src\github.com\pact-foundation\pact-go\examples\logs\pact.log --consumer MyConsumer --provider MyProvider]
2017/02/23 09:04:30 [DEBUG] starting mock service on port: 55267
2017/02/23 09:04:30 [DEBUG] starting service
2017/02/23 09:04:30 [INFO] service: [2017-02-23 09:04:30] INFO  WEBrick 1.3.1
2017/02/23 09:04:30 [INFO] service: [2017-02-23 09:04:30] INFO  ruby 2.1.5 (2014-11-13) [i386-mingw32]
2017/02/23 09:04:30 [INFO] service: [2017-02-23 09:04:30] INFO  WEBrick::HTTPServer#start: pid=10800 port=55267
2017/02/23 09:04:31 [DEBUG] daemon - stopping mock server
2017/02/23 09:04:31 [DEBUG] stopping service with pid 10280
2017/02/23 09:04:34 [INFO] service: [2017-02-23 09:04:34] ERROR Errno::ECONNRESET: An existing connection was forcibly closed by the remote host. @ io_fillbuf - fd:7
2017/02/23 09:04:34 [INFO] service:     C:/MYPATH/pact-mock-service/lib/vendor/ruby/2.1.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:80:in `eof?'
2017/02/23 09:04:34 [INFO] service:     C:/MYPATH/pact-mock-service/lib/vendor/ruby/2.1.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:80:in `run'
2017/02/23 09:04:34 [INFO] service:     C:/MYPATH/pact-mock-service/lib/vendor/ruby/2.1.0/gems/webrick-1.3.1/lib/webrick/server.rb:191:in `block in start_thread'
2017/02/23 09:04:34 [INFO] service: [2017-02-23 09:04:34] ERROR Errno::ECONNRESET: An existing connection was forcibly closed by the remote host. @ io_fillbuf - fd:8
2017/02/23 09:04:34 [INFO] service:     C:/MYPATH/pact-mock-service/lib/vendor/ruby/2.1.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:80:in `eof?'
2017/02/23 09:04:34 [INFO] service:     C:/MYPATH/pact-mock-service/lib/vendor/ruby/2.1.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:80:in `run'
2017/02/23 09:04:34 [INFO] service:     C:/MYPATH/pact-mock-service/lib/vendor/ruby/2.1.0/gems/webrick-1.3.1/lib/webrick/server.rb:191:in `block in start_thread'
2017/02/23 09:04:34 [INFO] service: [2017-02-23 09:04:34] ERROR Errno::ECONNRESET: An existing connection was forcibly closed by the remote host. @ io_fillbuf - fd:6
2017/02/23 09:04:34 [INFO] service:     C:/MYPATH/pact-mock-service/lib/vendor/ruby/2.1.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:80:in `eof?'
2017/02/23 09:04:34 [INFO] service:     C:/MYPATH/pact-mock-service/lib/vendor/ruby/2.1.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:80:in `run'
2017/02/23 09:04:34 [INFO] service:     C:/MYPATH/pact-mock-service/lib/vendor/ruby/2.1.0/gems/webrick-1.3.1/lib/webrick/server.rb:191:in `block in start_thread'

And from the consumer example:

2017/02/23 09:04:30 [DEBUG] pact setup logging
2017/02/23 09:04:30 [DEBUG] pact setup
2017/02/23 09:04:30 [DEBUG] client: starting a server
2017/02/23 09:04:30 [DEBUG] creating an HTTP client
2017/02/23 09:04:30 [DEBUG] waiting for port 6666 to become available
2017/02/23 09:04:30 [DEBUG] waiting for port 55267 to become available
2017/02/23 09:04:31 [DEBUG] pact add interaction
2017/02/23 09:04:31 [DEBUG] pact setup logging
2017/02/23 09:04:31 [DEBUG] pact setup
2017/02/23 09:04:31 [DEBUG] pact add interaction
2017/02/23 09:04:31 [DEBUG] pact setup logging
2017/02/23 09:04:31 [DEBUG] pact setup
2017/02/23 09:04:31 [DEBUG] pact verify
2017/02/23 09:04:31 [DEBUG] mock service add interaction
2017/02/23 09:04:31 [DEBUG] mock service response Body: Set interactions
2017/02/23 09:04:31 [DEBUG] mock service add interaction
2017/02/23 09:04:31 [DEBUG] mock service response Body: Set interactions
2017/02/23 09:04:31 [DEBUG] mock service verify
2017/02/23 09:04:31 [DEBUG] mock service response Body: Interactions matched
2017/02/23 09:04:31 [DEBUG] mock service delete interactions
2017/02/23 09:04:31 [DEBUG] mock service response Body: Deleted interactions
Test Passed!
2017/02/23 09:04:31 [DEBUG] teardown
2017/02/23 09:04:31 [DEBUG] client: stop server
2017/02/23 09:04:31 [DEBUG] creating an HTTP client
2017/02/23 09:04:31 [DEBUG] waiting for port 6666 to become available

Seems to be working.

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

Is there a Vagrant VM you're using for this perchance?

from pact-go.

serinth avatar serinth commented on August 31, 2024

This was run on Windows 10 Pro with VMWare Fusion.

from pact-go.

serinth avatar serinth commented on August 31, 2024

On Windows 10 Home (not emulated), I also get this error:

Tony@Home ~/Projects/go/src/github.com/pact-foundation/pact-go/examples (master)
$ ./consumer.exe
2017/02/09 19:03:09 Error on Verify: Post http://localhost:0/interactions: dial tcp [::1]:0: connectex: The requested address is not valid in its context.

The Pact daemon is running on 6666.

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

I'm wondering if perhaps the log path is the issue: H:\\pact-workshop\\pact-go-consumer\\logs/pact.log, note the forward slash in the path.

Looks like the default path for the log file is set at https://github.com/pact-foundation/pact-go/blob/master/dsl/pact.go#L90, and includes a '/' which is probably not portable (I'll fix that if it turns out it's the issue).

Could you please try manually setting the path and seeing if that helps?

from pact-go.

serinth avatar serinth commented on August 31, 2024
  1. First i modified client.go and changed the Dial and DialHTTP to point to localhost so that it could connect to the Daemon.
  2. Modified the consumer.go file to use DEBUG log level
  3. Modified pact.go and manually specified log file with:
if p.Server == nil {
		p.LogDir = filepath.FromSlash("C:/Users/Tony/Projects/Go/src/github.com/pact-foundation/pact-go/examples/log/pact.log")
		args := []string{
			fmt.Sprintf("--pact-specification-version %d", p.SpecificationVersion),
			fmt.Sprintf("--pact-dir %s", p.PactDir),
			fmt.Sprintf("--log %s", p.LogDir),
			fmt.Sprintf("--consumer %s", p.Consumer),
			fmt.Sprintf("--provider %s", p.Provider),
		}
		client := &PactClient{Port: p.Port}
		p.pactClient = client

		fmt.Println("ARGUMENTS ARE:", args)
		p.Server = client.StartServer(args)
	}

Also printed out the arguments to see what they were:

2017/02/13 11:01:27 [DEBUG] pact setup logging
2017/02/13 11:01:27 [DEBUG] pact setup
ARGUMENTS ARE: [--pact-specification-version 2 --pact-dir C:\Users\Tony\Projects\go\src\github.com\pact-foundation\pact-go\examples\pacts --log C:\Users\Tony\Projects\Go\src\github.com\pact-foundation\pact-go\examples\log\pact.log --consumer MyConsumer --provider MyProvider]
2017/02/13 11:01:27 [DEBUG] client: starting a server
2017/02/13 11:01:27 [DEBUG] creating an HTTP client
2017/02/13 11:01:27 [DEBUG] waiting for port 6666 to become available
2017/02/13 11:01:27 [DEBUG] waiting for port 58166 to become available
2017/02/13 11:01:29 [ERROR] Expected server to start < 1s. Timed out waiting for Mock Server to
                        start on port 58166 - are you sure it's running?
2017/02/13 11:01:29 [DEBUG] pact add interaction
2017/02/13 11:01:29 [DEBUG] pact setup logging
2017/02/13 11:01:29 [DEBUG] pact setup
2017/02/13 11:01:29 [DEBUG] pact add interaction
2017/02/13 11:01:29 [DEBUG] pact setup logging
2017/02/13 11:01:29 [DEBUG] pact setup
2017/02/13 11:01:29 [DEBUG] pact verify
2017/02/13 11:01:29 [DEBUG] mock service add interaction
2017/02/13 11:01:31 Error on Verify: Post http://localhost:58166/interactions: dial tcp [::1]:58166: connectex: No connection could be made because the target machine actively refused it.

Daemon was run with --logLevel DEBUG:

$ ./pact-go_windows_386.exe daemon --logLevel DEBUG
2017/02/13 11:01:21 [DEBUG] setting up a service manager
2017/02/13 11:01:21 [DEBUG] setting up a service manager
2017/02/13 11:01:21 [DEBUG] setting up a service manager
2017/02/13 11:01:21 [DEBUG] setting up a service manager
2017/02/13 11:01:21 [INFO] daemon - starting daemon on port 6666
2017/02/13 11:01:21 [DEBUG] starting service removal monitor
2017/02/13 11:01:21 [DEBUG] starting service creation monitor
2017/02/13 11:01:21 [DEBUG] starting service removal monitor
2017/02/13 11:01:21 [DEBUG] starting service creation monitor
2017/02/13 11:01:21 [DEBUG] starting service creation monitor
2017/02/13 11:01:21 [DEBUG] starting service removal monitor
2017/02/13 11:01:21 method Shutdown has wrong number of ins: 1
2017/02/13 11:01:21 method StartDaemon has wrong number of ins: 2
2017/02/13 11:01:21 [DEBUG] starting service removal monitor
2017/02/13 11:01:21 [DEBUG] starting service creation monitor
2017/02/13 11:01:27 [DEBUG] daemon - starting mock server
2017/02/13 11:01:27 [DEBUG] starting mock service on port: 58166
2017/02/13 11:01:27 [DEBUG] starting service
2017/02/13 11:01:28 [INFO] service: ERROR: "pact-mock-service.rb service" was called with arguments ["--port 58166", "--pact-specification-version 2", "--pact-dir C:\\Users\\Tony\\Projects\\go\\src\\github.com\\pact-foundation\\pact-go\\examples\\pacts", "--log C:\\Users\\Tony\\Projects\\go\\src\\github.com\\pact-foundation\\pact-go\\examples\\log\\pact.log", "--consumer MyConsumer", "--provider MyProvider"]
2017/02/13 11:01:28 [INFO] service: Usage: "pact-mock-service.rb service"

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

Thanks for this @serinth! Might be an issue with the latest mock service or how we provide the arguments to it, I'll dig into it.

Out of interest, can you run the mock service independently of Pact Go? e.g. <path to pact-go>\pact-mock-service\bin\pact-mock-service <args> ?

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

Have verified this issue locally.

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

Update. With your client updates above and also modifying the flags sent to the Ruby Mock Service I have been able to get a successful test case running examples/consumer.go.

The flags must be sent individually, rather than as key-pair combinations (e.g. https://github.com/pact-foundation/pact-go/blob/master/dsl/pact.go#L88-L92) .

I'll continue to look into it this week and find a solution that works nicely for both Windows and non-Windows clients.

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

OK, I just have one remaining issue. When the tests complete, the connection to the Ruby service seems to remain open. The interrupt signal is being received, but Ruby doesn't want to shut down. Need to track down why there is a connection, but I have managed to create a workaround which I'll publish shortly to this branch.

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

I've pushed a package that I've tested on a local Windows VM (Windows 11, 64bit).

Could you please check it out? (v0.0.3)

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

It seems due to the naming of my branch that was merged closed the ticket - reopening until you can confirm.

from pact-go.

mefellows avatar mefellows commented on August 31, 2024

Great - sorry about the logs though - eww!

I'm looking into the underlying cause of the connection not closing (this work was probably required anyway). I'll close this for now and re-open another ticket to resolve the logging situation.

from pact-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.