-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix few bugs for multiple deployment (#33)
- Loading branch information
1 parent
96d47e6
commit a3b9cb6
Showing
7 changed files
with
162 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ var ( | |
tasks bool | ||
verbose bool | ||
SSLInsecure bool | ||
parallel int | ||
) | ||
|
||
var RootCmd = &cobra.Command{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package connectors | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"gopkg.in/jarcoal/httpmock.v1" | ||
"net/http" | ||
"testing" | ||
) | ||
|
||
// This test a side effect of resty: when retry on 409 the error of response is not reinitialized | ||
func Test_Get(t *testing.T) { | ||
|
||
client := newBaseClient("http://randomurl") | ||
// mock HTTP response | ||
{ | ||
typedClient := client.(*baseClient) | ||
httpmock.Reset() | ||
httpmock.ActivateNonDefault(typedClient.restClient.GetClient()) | ||
defer httpmock.DeactivateAndReset() | ||
|
||
i := 0 | ||
myresponder := func(req *http.Request) (*http.Response, error) { | ||
i++ | ||
if i == 1 { | ||
jsonresp, _ := httpmock.NewJsonResponse(409, ErrorResponse{Message: "some random msg"}) | ||
res := new(http.Response) | ||
*res = *jsonresp | ||
res.Request = req | ||
return res, nil | ||
} | ||
jsonresp, _ := httpmock.NewJsonResponse(200, ConnectorResponse{Name: "test"}) | ||
res := new(http.Response) | ||
*res = *jsonresp | ||
res.Request = req | ||
return res, nil | ||
} | ||
|
||
httpmock.RegisterResponder("GET", "http://randomurl/connectors/test", myresponder) | ||
} | ||
|
||
//Act | ||
connector, err := client.GetConnector(ConnectorRequest{Name: "test"}) | ||
|
||
assert.Equal(t, "test", connector.Name) | ||
assert.NoError(t, err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters