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

clean org and maintainer at the end of the test #279

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

jirkasemmler
Copy link
Contributor

@jirkasemmler jirkasemmler commented Jan 3, 2025

Jira: CT-XXX
Connection PR: XXXXX

Before asking for review make sure that:

Checklist

  • New client method(s) has tests
  • Apiary file is updated
  • You declared if there is a BC break or not (will affect next release of a client)

Release

  • I gave the PR a proper label:
    • major (BC break)
    • minor (new feature)
    • patch (backwards compatible fix)
    • no release (just test changes)

I was looking for redshift projects on e2e and I found tons of maintainers and orgs -> this test does not clean after itself, so it should. There is no need for extra logic. if it fails and there will be an extra maintainer/org, nothing would happen

@jirkasemmler jirkasemmler added the no release just test changes label Jan 3, 2025
@jirkasemmler jirkasemmler requested review from a team, martinsifra and vojtabiberle and removed request for a team and martinsifra January 3, 2025 12:06
@jirkasemmler
Copy link
Contributor Author

zaklad jsem procistil, takze to nemusis uz scrollovat roky

    public function testCleanUp()
    {
        $client = new \Keboola\ManageApi\Client([
            'url' => 'https://connection.e2e.us-east-1.aws.keboola.dev/',
            'token' => 'tralalla',
        ]);
        $list = $client->listMaintainers();
        foreach ($list as $maintainer){
            $canDelete = true;
            if ($maintainer['name'] === 'My test project storage assign maintainer') {
                $orgs = $client->listMaintainerOrganizations($maintainer['id']);
                foreach ($orgs as $org) {
                    echo "deleting org ". $org['id'] . "\n";
                    try{
                        $client->deleteOrganization($org['id']);
                    }
                    catch (\Keboola\ManageApi\ClientException $e) {
                        echo $e->getMessage();
                        $canDelete = false;
                    }
                }
                if($canDelete){
                    echo "deleting maintainer ". $maintainer['id'] . "\n";
                    $client->deleteMaintainer($maintainer['id']);
                }
            }
        }
    }

@jirkasemmler jirkasemmler merged commit d0eca6f into master Jan 3, 2025
3 checks passed
@jirkasemmler jirkasemmler deleted the jirka-clean-maintainer-and-org-after-test branch January 3, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no release just test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants