-
Notifications
You must be signed in to change notification settings - Fork 82
Conversation
namespace: "kyma-dev" | ||
environment: "dev" | ||
required: false | ||
disabled: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should have this set to true
by default, because we use overrides with other necessary values anyway
@@ -197,6 +202,11 @@ func main() { | |||
step: provisioning.NewProvideLmsTenantStep(lmsTenantManager, db.Operations()), | |||
disabled: cfg.LMS.Disabled, | |||
}, | |||
{ | |||
weight: 1, | |||
step: provisioning.NewEDPRegistration(db.Operations(), edpClient, cfg.EDP), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to rename it to be consistent with convention
step: provisioning.NewEDPRegistration(db.Operations(), edpClient, cfg.EDP), | |
step: provisioning.NewEDPRegistrationStep(db.Operations(), edpClient, cfg.EDP), |
}{ | ||
{ | ||
weight: 1, | ||
step: deprovisioning.NewAvsEvaluationsRemovalStep(avsDel, db.Operations(), externalEvalAssistant, internalEvalAssistant), | ||
}, | ||
{ | ||
weight: 1, | ||
step: deprovisioning.NewEDPDeregistration(edpClient, cfg.EDP), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above:
step: deprovisioning.NewEDPDeregistration(edpClient, cfg.EDP), | |
step: deprovisioning.NewEDPDeregistrationStep(edpClient, cfg.EDP), |
if err != nil { | ||
return []MetadataItem{}, errors.Wrap(err, "while requesting about dataTenant metadata") | ||
} | ||
defer c.closeResponseBody(response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the same pattern as used in this PR: #1190
same suggestion for other occurrences
return kebError.NewTemporaryError("EDP server returns failed status %s", responseLog(response)) | ||
} | ||
|
||
c.log.Errorf("EDP server notsupported response %s: %s", responseLog(response), body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c.log.Errorf("EDP server notsupported response %s: %s", responseLog(response), body) | |
c.log.Errorf("EDP server not supported response %s: %s", responseLog(response), body) |
Disabled bool | ||
} | ||
|
||
func CreateEDPAdminClient(config Config, log logrus.FieldLogger) *Client { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot we make it simpler and just do that in NewClient
method? because for me it's not a builder but normal constructor 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to avoid creating oAuth client inside EDP client constructor, thanks DI I can simply in test inject client from httptest.NewServer
, I couldn't find oAuth client test. If you see any simple solution about how to create oAuth inside EDP client and easily handle it in the test not implement all oAuth paths then I am open to suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's discuss that f2f. I know some trick for such tests :)
|
||
func CreateEDPAdminClient(config Config, log logrus.FieldLogger) *Client { | ||
data := url.Values{} | ||
data.Add("grant_type", "client_credentials") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed - it is already set by clientcredentials
client
func CreateEDPAdminClient(config Config, log logrus.FieldLogger) *Client { | ||
data := url.Values{} | ||
data.Add("grant_type", "client_credentials") | ||
data.Add("scope", "edp-namespace.read edp-namespace.update") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use Scope
field on clientcredentials.Config
client := NewClient(config, testServer.Client(), logrus.New()) | ||
|
||
// when | ||
err := client.CreateDataTenant(DataTenantPayload{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changing impl to
func (c *Client) CreateDataTenant(data DataTenantPayload) error {
return nil
}
and test still green :/
same problems with other tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed TestClient_CreateDataTenant
and TestClient_DeleteDataTenant
AdminURL: testServer.URL, | ||
Namespace: testNamespace, | ||
} | ||
client := NewClient(config, testServer.Client(), logrus.New()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use logger.NewLogDummy()
. Because right now it produces logs which only mess the test output. If you want to assert that given msg was logged then use logger.NewLogSpy()
. The same suggestion for all others occurrences
var metadata []MetadataItem | ||
err = json.NewDecoder(response.Body).Decode(&metadata) | ||
if err != nil { | ||
return metadata, errors.Wrap(err, "while decoding dataTenant metadata response") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the best practice is to return zero-value in case of error
func (c *Client) processResponse(response *http.Response) error { | ||
byteBody, err := ioutil.ReadAll(response.Body) | ||
if err != nil { | ||
return errors.Wrapf(err, "while reading response body") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add also info about status code as this can be helpful
labels: | ||
{{ include "kyma-env-broker.labels" . | indent 4 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labels: | |
{{ include "kyma-env-broker.labels" . | indent 4 }} | |
labels: {{ include "kyma-env-broker.labels" . | nindent 4 }} |
IMO it's better because thanks to the nindent
we do not need to take care of the proper indent before the {{
and we had already a few problems with wrong indent in past.
Description
Changes proposed in this pull request: