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

[POC][tests-only] add endpoints to accept ocis commands #9546

Merged
merged 14 commits into from
Jul 9, 2024

Conversation

saw-jan
Copy link
Member

@saw-jan saw-jan commented Jul 5, 2024

Description

Added endpoints to run ocis command via API requests. These endpoints can be used by the test to run ocis commands.
Along with it, added CLI test for resetting user password.

Added endpoints:

  • POST: /command - run ocis command
curl -XPOST "http://localhost:5200/command \
-d '{"command": "idm resetpassword -u admin", "inputs": ["1234", "1234"]}'
{
    "status": "OK",
    "exitCode": 0,
    "message": "<command output>"
}
...
{
    "status": "ERROR",
    "exitCode": 1,
    "message": "<command output>"
}
  • POST: /start - start ocis server
curl -XPOST "http://localhost:5200/start
{
    "status": "OK",
    "message": "..."
}
...
{
    "status": "ERROR",
    "message": "..."
}
  • POST: /stop - stop ocis server
curl -XPOST "http://localhost:5200/start
{
    "status": "OK",
    "message": "..."
}
...
{
    "status": "ERROR",
    "message": "..."
}

Added CLI test:

Scenario: reset user password

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@saw-jan saw-jan force-pushed the ociswrapper/new-endpoints branch from 59d681d to 9de8d98 Compare July 9, 2024 06:05
} catch (ConnectException $e) {
throw new \Error("Cannot connect to the ociswrapper at the moment, make sure that ociswrapper is running before proceeding with the test run.\n" . $e->getMessage());
} catch (GuzzleException $ex) {
$response = $ex->getResponse();
Copy link
Contributor

Choose a reason for hiding this comment

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

WHat will it throw if it's GuzzleException and response is not null?

Copy link
Member Author

@saw-jan saw-jan Jul 9, 2024

Choose a reason for hiding this comment

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

it will not throw but returns the response

tests/ociswrapper/README.md Outdated Show resolved Hide resolved
tests/ociswrapper/README.md Outdated Show resolved Hide resolved
tests/ociswrapper/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@ScharfViktor ScharfViktor left a comment

Choose a reason for hiding this comment

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

other looks good 👍

@saw-jan saw-jan force-pushed the ociswrapper/new-endpoints branch from 9de8d98 to d8ab9c5 Compare July 9, 2024 07:31
@saw-jan saw-jan requested a review from phil-davis July 9, 2024 07:31
Copy link

sonarcloud bot commented Jul 9, 2024

@saw-jan saw-jan merged commit bd7cd62 into master Jul 9, 2024
4 checks passed
@saw-jan saw-jan deleted the ociswrapper/new-endpoints branch July 9, 2024 08:17
ownclouders pushed a commit that referenced this pull request Jul 9, 2024
[POC][tests-only] add endpoints to accept ocis commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants