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

Corrected Binding Insert Order #1366

Merged
merged 17 commits into from
Oct 24, 2024
Merged

Conversation

ralikio
Copy link
Member

@ralikio ralikio commented Oct 21, 2024

Description

Changes proposed in this pull request:

  • put insert before K8S resources creation in binding creation process,
  • test that rely on nil providers to make sure that before panic occurs the test created a binding,
  • updating expires at and a kubeconfig after its generation,
  • asserting that expires at is set even when failed occured.

Related issue(s)

#1364

@ralikio ralikio requested a review from a team as a code owner October 21, 2024 08:27
@kyma-bot kyma-bot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 21, 2024
@kyma-gopher-bot kyma-gopher-bot enabled auto-merge (squash) October 21, 2024 08:27
@kyma-bot kyma-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 21, 2024
@ralikio ralikio marked this pull request as draft October 21, 2024 08:27
auto-merge was automatically disabled October 21, 2024 08:27

Pull request was converted to draft

@kyma-bot kyma-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 21, 2024
@ralikio ralikio added the kind/enhancement Categorizes issue or PR as related to modifying or improving an existing feature label Oct 21, 2024
}()

// given
_, err := db.Bindings().Get(instanceID1, "binding-id")
Copy link
Member

@piotrmiskiewicz piotrmiskiewicz Oct 21, 2024

Choose a reason for hiding this comment

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

I don't want to force my idea, just to see another idea:

type provider struct {
}

func (p *provider) K8sClientSetForRuntimeID(runtimeID string) (kubernetes.Interface, error) {
	c := fake.NewSimpleClientset()
	c.PrependReactor("create", "serviceaccounts", func(action k8stesting.Action) (bool, runtime.Object, error) {
		return true, nil, fmt.Errorf("error")
	})
	return c, nil
}

then the test without recover:

_, err = db.Bindings().Get(instanceID1, "binding-id")
	require.Error(t, err)
	require.True(t, dberr.IsNotFound(err))

	// when
	_, _ = bindEndpoint.Bind(context.Background(), instanceID1, "binding-id", domain.BindDetails{
		ServiceID: "123",
		PlanID:    fixture.PlanId,
	}, false)

	// then
	binding, err := db.Bindings().Get(instanceID1, "binding-id")
	require.NoError(t, err)
	require.Equal(t, instanceID1, binding.InstanceID)
	require.Equal(t, "binding-id", binding.ID)

@ralikio edit: simplified in b8e8d1e

@ralikio ralikio marked this pull request as ready for review October 24, 2024 09:52
@kyma-bot kyma-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 24, 2024
@kyma-gopher-bot kyma-gopher-bot enabled auto-merge (squash) October 24, 2024 09:52
@kyma-project kyma-project deleted a comment from github-actions bot Oct 24, 2024
@kyma-bot kyma-bot added the lgtm Looks good to me! label Oct 24, 2024
@kyma-gopher-bot kyma-gopher-bot merged commit 07fa3b9 into main Oct 24, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA. kind/enhancement Categorizes issue or PR as related to modifying or improving an existing feature lgtm Looks good to me! size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants