Skip to content

Commit

Permalink
[tests-only][full-ci]Add step to set quota with env `OCIS_SPACES_MAX_…
Browse files Browse the repository at this point in the history
…QUOTA` (#6402)

* Add step to set ocis max spaces quota with env

* Add env-config tag to scenario for ocis roll back

* Fix red CI and and test for spaces

* Review address

* Reuse step for single env

* Remove doubtful scenario
  • Loading branch information
SagarGi authored Jun 6, 2023
1 parent bad52af commit 7bac14d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions tests/acceptance/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ default:
- TUSContext:
- SpacesTUSContext:
- GraphContext:
- OcisConfigContext:

apiSpacesShares:
paths:
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiCors/cors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: CORS headers

Background:
Given user "Alice" has been created with default attributes and without skeleton files
And cors allowed origins has been set to "https://aphno.badal"
And the config "OCIS_CORS_ALLOW_ORIGINS" has been set to "https://aphno.badal"

@issue-5195
Scenario Outline: CORS headers should be returned when setting CORS domain sending origin header
Expand Down
10 changes: 9 additions & 1 deletion tests/acceptance/features/apiSpaces/quota.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api
@api
Feature: State of the quota
As a user
I want to be able to see the state of the quota
Expand Down Expand Up @@ -122,3 +122,11 @@ Feature: State of the quota
| /filesForUpload/lorem-big.txt | /ocs/v1.php/cloud/users/%username% | 100 | 91.17 |
| /filesForUpload/lorem.txt | /ocs/v2.php/cloud/users/%username% | 200 | 6.99 |
| /filesForUpload/lorem-big.txt | /ocs/v2.php/cloud/users/%username% | 200 | 91.17 |


@env-config
Scenario: upload a file by setting OCIS spaces max quota
Given the config "OCIS_SPACES_MAX_QUOTA" has been set to "10"
And user "Brian" has been created with default attributes and without skeleton files
When user "Brian" uploads file with content "more than 10 bytes content" to "lorem.txt" using the WebDAV API
Then the HTTP status code should be "507"
12 changes: 7 additions & 5 deletions tests/acceptance/features/bootstrap/OcisConfigContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

use Behat\Behat\Context\Context;
use GuzzleHttp\Exception\GuzzleException;
use TestHelpers\OcisConfigHelper;
use PHPUnit\Framework\Assert;

Expand Down Expand Up @@ -52,23 +53,24 @@ public function asyncUploadHasbeenEnabledWithDelayedPostProcessing(string $delay
}

/**
* @Given cors allowed origins has been set to :allowedOrigins
* @Given the config :configVariable has been set to :configValue
*
* @param string $allowedOrigins
* @param string $configVariable
* @param string $configValue
*
* @return void
* @throws GuzzleException
*/
public function corsAllowedOriginsHasBeenSet(string $allowedOrigins): void {
public function theConfigHasBeenSetTo(string $configVariable, string $configValue): void {
$envs = [
"OCIS_CORS_ALLOW_ORIGINS" => $allowedOrigins,
$configVariable => $configValue,
];

$response = OcisConfigHelper::reConfigureOcis($envs);
Assert::assertEquals(
200,
$response->getStatusCode(),
"Failed to set OCIS_CORS_ALLOW_ORIGINS=" . $allowedOrigins
"Failed to set config $configVariable=$configValue"
);
}

Expand Down

0 comments on commit 7bac14d

Please sign in to comment.