Skip to content

Extended.deploymentconfigs viewing rollout history [Conformance] should print the rollout history #15792

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

Closed
mfojtik opened this issue Aug 16, 2017 · 6 comments
Assignees
Labels
component/apps kind/test-flake Categorizes issue or PR as related to test flakes. priority/P1

Comments

@mfojtik
Copy link
Contributor

mfojtik commented Aug 16, 2017

Not sure if flake or something I broke in #15624 (likely not):

go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/test/extended/deployments/deployments.go:566
Expected error:
    <*errors.StatusError | 0xc4218b3b80>: {
        ErrStatus: {
            TypeMeta: {Kind: "", APIVersion: ""},
            ListMeta: {SelfLink: "", ResourceVersion: ""},
            Status: "Failure",
            Message: "User \"extended-test-cli-deployment-k564x-32rl3-user\" cannot list replicationcontrollers in project \"extended-test-cli-deployment-k564x-32rl3\"",
            Reason: "Forbidden",
            Details: {
                Name: "",
                Group: "",
                Kind: "replicationcontrollers",
                UID: "",
                Causes: nil,
                RetryAfterSeconds: 0,
            },
            Code: 403,
        },
    }
    User "extended-test-cli-deployment-k564x-32rl3-user" cannot list replicationcontrollers in project "extended-test-cli-deployment-k564x-32rl3"
not to have occurred
/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/test/extended/deployments/deployments.go:530

Logs: https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_extended_conformance_gce/6053/testReport/junit/(root)/Extended/deploymentconfigs_viewing_rollout_history__Conformance__should_print_the_rollout_history/

@tnozicka
Copy link
Contributor

This seem like an issue where new project/user is created by the testing framework and it manages to run the Describe func before that SA has appropriate permissions picked up. We might want to check that in testing framework before running describe or make sure the SA is ok other way. Doesn't seem specific to Deployments.

@tnozicka tnozicka assigned enj and tnozicka and unassigned tnozicka Aug 16, 2017
@enj
Copy link
Contributor

enj commented Aug 17, 2017

@mfojtik @tnozicka This setup function looks incorrect (note that project request is always best effort - it tries for ~6 seconds to make sure you have your permissions, but it won't just hang there until you get your permissions):

// SetupProject creates a new project and assign a random user to the project.
// All resources will be then created within this project and Kubernetes E2E
// suite will destroy the project after test case finish.
func (c *CLI) SetupProject(name string, kubeClient kclientset.Interface, _ map[string]string) (*kapiv1.Namespace, error) {
	newNamespace := names.SimpleNameGenerator.GenerateName(fmt.Sprintf("extended-test-%s-", name))
	c.SetNamespace(newNamespace).ChangeUser(fmt.Sprintf("%s-user", c.Namespace()))
	e2e.Logf("The user is now %q", c.Username())

	e2e.Logf("Creating project %q", c.Namespace())
	_, err := c.Client().ProjectRequests().Create(&projectapi.ProjectRequest{
		ObjectMeta: metav1.ObjectMeta{Name: c.Namespace()},
	})
	if err != nil {
		e2e.Logf("Failed to create a project and namespace %q: %v", c.Namespace(), err)
		return nil, err
	}
	if err := wait.ExponentialBackoff(retry.DefaultBackoff, func() (bool, error) {
		if _, err := c.KubeClient().Core().Pods(c.Namespace()).List(metav1.ListOptions{}); err != nil {
			if apierrs.IsForbidden(err) {
				e2e.Logf("Waiting for user to have access to the namespace")
				return false, nil
			}
			////////////////////// What about other errors??
			////////////////////// Doing a self SAR against the namespace for an admin only permission seems more appropriate (create RBAC role binding perhaps?)
		}
		return true, nil
	}); err != nil {
		return nil, err
	}
	return &kapiv1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: c.Namespace()}}, err
}

@tnozicka
Copy link
Contributor

tnozicka commented Oct 3, 2017

Ignoring other errors is wrong and I that can be fixed fairly easily.

@enj or should we move this self SAR as you suggested? I didn't have the opportunity to meet that code yet so I would appreciate some pointers if this is the correct path or if you want to take it, it's yours :)

@enj
Copy link
Contributor

enj commented Oct 4, 2017

I do not have cycles right now to take it, but this should help you get started:

c.KubeClient().AuthorizationV1().SelfSubjectAccessReviews().Create(
	&authorizationapi.SelfSubjectAccessReview{
		Spec: authorizationapi.SelfSubjectAccessReviewSpec{
			ResourceAttributes: &authorizationapi.ResourceAttributes{
				Namespace: c.Namespace(),
				Verb:      "create",
				Group:     rbac.GroupName,
				Resource:  "roles",
			},
		},
	},
)

@enj
Copy link
Contributor

enj commented Oct 4, 2017

The response will tell you if the action is allowed (it should only ever error if the server is down or not healthy).

@tnozicka
Copy link
Contributor

tnozicka commented Oct 6, 2017

@enj thx for the pointer

openshift-merge-robot added a commit that referenced this issue Oct 6, 2017
…ovisioning

Automatic merge from submit-queue (batch tested with PRs 16617, 16719).

Fix extended test namespace provisioning - wait for SA using selfSAR

Fixes #15792
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/apps kind/test-flake Categorizes issue or PR as related to test flakes. priority/P1
Projects
None yet
Development

No branches or pull requests

3 participants