Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add octopus.push.package step support #53

Merged
merged 4 commits into from
Jan 31, 2019

Conversation

ss-remygreinhofer
Copy link
Contributor

This patch implements the support for Octopus
(https://octopus.com/docs/api-and-integration/teamcity). It allows to
define a new type of build step: "octopus.push.package".

@ss-remygreinhofer ss-remygreinhofer force-pushed the octopus-push-package-step branch 2 times, most recently from b4213a0 to ead09ff Compare January 4, 2019 19:48
@cvbarros
Copy link
Owner

Hello @ss-remygreinhofer , sorry for not getting to this sooner! Thanks a lot for your contribution - however, would it be possible to add some tests that cover the usage for the new step type?

Recently, I'm trying to refactor tests to testify suites in order to deal with some isolation and cleanup issues I've had in the past. Take a look at 7ef46f9 and if you need any help adding test scenarios, let me know!

@ss-remygreinhofer
Copy link
Contributor Author

No problem, I'll work on some testify tests.

@ss-remygreinhofer ss-remygreinhofer force-pushed the octopus-push-package-step branch from ead09ff to aceb9ed Compare January 30, 2019 20:24
@ss-remygreinhofer
Copy link
Contributor Author

ss-remygreinhofer commented Jan 30, 2019

I just rebased my branch and although Travis gives me the green mark, the tests fail on my machine:

$ go test -v ./...
[...]
=== RUN   TestAgentRequirement_Create
--- FAIL: TestAgentRequirement_Create (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x134074a]

goroutine 63 [running]:
testing.tRunner.func1(0xc000125a00)
	/usr/local/Cellar/go/1.11.5/libexec/src/testing/testing.go:792 +0x387
panic(0x13bf540, 0x173fb40)
	/usr/local/Cellar/go/1.11.5/libexec/src/runtime/panic.go:513 +0x1b9
github.com/cvbarros/go-teamcity-sdk/teamcity_test.createTestBuildTypeInternal(0xc000125a00, 0x0, 0x14287b5, 0x14, 0x1425043, 0xb, 0x10e0001, 0x156b058)
	/Users/remygreinhofer/go/src/github.com/cvbarros/go-teamcity-sdk/teamcity/build_type_test.go:272 +0x1aa
github.com/cvbarros/go-teamcity-sdk/teamcity_test.createTestBuildTypeWithName(0xc000125a00, 0x0, 0x14287b5, 0x14, 0x1425043, 0xb, 0x1488c01, 0xc000123ca0)
	/Users/remygreinhofer/go/src/github.com/cvbarros/go-teamcity-sdk/teamcity/build_type_test.go:261 +0x6e
github.com/cvbarros/go-teamcity-sdk/teamcity_test.createTestBuildType(0xc000125a00, 0x0, 0x14287b5, 0x14, 0x104c0ba)
	/Users/remygreinhofer/go/src/github.com/cvbarros/go-teamcity-sdk/teamcity/build_type_test.go:257 +0x63
github.com/cvbarros/go-teamcity-sdk/teamcity_test.TestAgentRequirement_Create(0xc000125a00)
	/Users/remygreinhofer/go/src/github.com/cvbarros/go-teamcity-sdk/teamcity/agent_requirement_test.go:14 +0x8a
testing.tRunner(0xc000125a00, 0x143d9d0)
	/usr/local/Cellar/go/1.11.5/libexec/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
	/usr/local/Cellar/go/1.11.5/libexec/src/testing/testing.go:878 +0x35c
FAIL	github.com/cvbarros/go-teamcity-sdk/teamcity	0.021s

I'm not sure wether it is a platform difference, or a go version problem.

$ go version
go version go1.11.5 darwin/amd64

EDIT
I ran the tests both from master and my branch and I got the same results.

@ss-remygreinhofer
Copy link
Contributor Author

ss-remygreinhofer commented Jan 30, 2019

You can scratch the previous comment, I forgot to set the TEAMCITY_ADDR environment variable... Now all the tests are passing.

This led me to write a Makefile to simplify this type of tasks: PR #57 .

@ss-remygreinhofer
Copy link
Contributor Author

@cvbarros I added some tests to ensure the new step can be created and added (I did the same thing you did for the PowerShell step) and I updated the setup to install the Octopus plugin automatically.

I did include PR #57 into this one as it seems clearer to me that way, but in case you reject it for some reason, I could figure out a way around it.

@cvbarros
Copy link
Owner

I've merged #57 first, sorry missed the comment. I think after a rebase this will be good to be merged!
How was it to add tests to the new structure? Any feedback?
Thanks!

ss-remygreinhofer and others added 4 commits January 31, 2019 15:06
This patch implements the support for Octopus
(https://octopus.com/docs/api-and-integration/teamcity). It allows to
define a new type of build step: "octopus.push.package".
Upstream updated the Step interface. This patch makes sure that the
Octopus steps implement it correctly.
Adds tests for the StepOctopusPushPackage. This ensure the new build
step can be added correctly.
@ss-remygreinhofer ss-remygreinhofer force-pushed the octopus-push-package-step branch from 2f7c40d to 6a85f20 Compare January 31, 2019 21:07
@ss-remygreinhofer
Copy link
Contributor Author

The branch is rebased.

Testify looks like a great framework, and the reference in the Go world for asserting and mocking, but my experience is too limited to provide you with valuable feedback. Besides I just mirrored what you did for the PowerShell step, so it was very straightforward.

Let me send you a few more PRs and I'll have an opinion 😉

@cvbarros
Copy link
Owner

Nice! Thanks a lot for the contribution, going to merge this.

@cvbarros cvbarros merged commit 9abe613 into cvbarros:master Jan 31, 2019
@ss-remygreinhofer ss-remygreinhofer deleted the octopus-push-package-step branch January 31, 2019 21:43
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants