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

Creating a customer #87

Merged
merged 3 commits into from Jan 16, 2020
Merged

Creating a customer #87

merged 3 commits into from Jan 16, 2020

Conversation

dexhorthy
Copy link
Member

@dexhorthy dexhorthy commented Jan 16, 2020

$ go run ./cli customer create --name foo --channel testing  --expires-in '2400h'

ID                                  NAME    CHANNELS    EXPIRES                          TYPE
rNNNKfYzTUKM51_tDgAZieFXS1Uzy3_r    foo     dextaste    2020-04-25 20:27:41 +0000 UTC    dev

- add customer create command
- expand list customer query to pull expiration date and license type
- remove {shipclient,kotsclient,platformclient}.Client interfaces, they were not adding anything, and made code navigation difficult
- Refactor get-or-create-channel logic from `replicated release create --promote` into a Client-level `GetChannelByName` with an optional `create` flag to create the channel
@dexhorthy dexhorthy changed the title Create ensure customer Creating a customer Jan 16, 2020
)

type Client interface {
Copy link
Member Author

@dexhorthy dexhorthy Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed these interfaces because they don't add a ton, and I have some thoughts about how to restructure this whole client thing.

I also short-circuited directly to the implementations to improve code nav.

@dexhorthy
Copy link
Member Author

@laverya looks like a failure in your pact test, which might be my fault, but hard to tell from the NPE:
https://travis-ci.org/replicatedhq/replicated/builds/638126610#L311-L330

Let me know if you have any ideas off the top of your head otherwise I can try to dig in deeper on the failure.

   
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=0x0 pc=0x6bf1ec]
goroutine 10 [running]:
testing.tRunner.func1(0xc000180700)
	/usr/local/go/src/testing/testing.go:830 +0x392
panic(0x70f700, 0x9f72a0)
	/usr/local/go/src/runtime/panic.go:522 +0x1b5
github.com/replicatedhq/replicated/pkg/shipclient.Test_UploadRelease.func1(0xc0001c0de8, 0xc00017cc00)
	/go/src/github.com/replicatedhq/replicated/pkg/shipclient/release_test.go:105 +0x32c
github.com/replicatedhq/replicated/vendor/github.com/pact-foundation/pact-go/dsl.(*Pact).Verify(0xa030e0, 0xc00001e840, 0x76d91e, 0x6)
	/go/src/github.com/replicatedhq/replicated/vendor/github.com/pact-foundation/pact-go/dsl/pact.go:260 +0x2d2
github.com/replicatedhq/replicated/pkg/shipclient.Test_UploadRelease(0xc000180700)
	/go/src/github.com/replicatedhq/replicated/pkg/shipclient/release_test.go:152 +0xad9
testing.tRunner(0xc000180700, 0x785278)
	/usr/local/go/src/testing/testing.go:865 +0xc0
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:916 +0x35a
FAIL	github.com/replicatedhq/replicated/pkg/shipclient	3.628s

KotsClient kotsclient.Client
PlatformClient *platformclient.HTTPClient
ShipClient *shipclient.GraphQLClient
KotsClient *kotsclient.GraphQLClient
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should simplify codenav

if appType == "platform" {
return nil, errors.New("ensure-channel operations are not supported for platform applications")
} else if appType == "ship" {
return nil, errors.New("ensure-channel operations are not supported for ship applications")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not have GetChannelByName without the ensure-channel bits for these schedulers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't a regression though, so not a blocker

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just, didn't feel like implementing it. This is partially because the current code structure requires a lot of code dupe to do so

@dexhorthy dexhorthy merged commit 9c7023b into master Jan 16, 2020
@dexhorthy dexhorthy deleted the create-ensure-customer branch January 30, 2020 20:06
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.

None yet

2 participants