-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add integration tests for automatic project deletion #4136
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tests/src/test/scala/ch/epfl/bluebrain/nexus/tests/kg/AutoProjectDeletionSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package ch.epfl.bluebrain.nexus.tests.kg | ||
|
||
import akka.http.scaladsl.model.StatusCodes | ||
import ch.epfl.bluebrain.nexus.tests.BaseSpec | ||
import ch.epfl.bluebrain.nexus.tests.Identity.projects.Bojack | ||
import ch.epfl.bluebrain.nexus.tests.iam.types.Permission.{Events, Organizations, Projects, Resources} | ||
import monix.execution.Scheduler.Implicits.global | ||
import io.circe.Json | ||
|
||
import scala.concurrent.duration._ | ||
|
||
/** | ||
* Tests related to automatic project deletion | ||
* | ||
* Automatic deletion is configured to look up on projects in the `autodeletion` organization and deletes them after 5 | ||
* seconds without activity | ||
* | ||
* Only checks that the project deletion has been triggered and that the project itself has been deleted. All the | ||
* additional checks on the deletion of resources/views contained in this project are done in [[ProjectsDeletionSpec]] | ||
* | ||
* @see | ||
* ProjectsDeletionSpec | ||
*/ | ||
class AutoProjectDeletionSpec extends BaseSpec { | ||
|
||
// We double the default patience in order to make sure that the automatic deletion has time to process the project | ||
implicit override def patienceConfig: PatienceConfig = PatienceConfig(config.patience * 2, 300.millis) | ||
|
||
private val org = "autodeletion" | ||
private val proj1 = genId() | ||
private val ref1 = s"$org/$proj1" | ||
|
||
override def beforeAll(): Unit = { | ||
super.beforeAll() | ||
val setup = for { | ||
_ <- aclDsl.addPermissions("/", Bojack, Set(Organizations.Create, Projects.Delete, Resources.Read, Events.Read)) | ||
// First org and projects | ||
_ <- adminDsl.createOrganization(org, org, Bojack, ignoreConflict = true) | ||
_ <- adminDsl.createProject(org, proj1, kgDsl.projectJson(name = proj1), Bojack) | ||
_ <- deltaClient.get[Json](s"/projects/$ref1", Bojack)(expect(StatusCodes.OK)) | ||
} yield succeed | ||
|
||
setup.void.runSyncUnsafe() | ||
} | ||
|
||
"eventually return a not found when attempting to fetch the project" in eventually { | ||
deltaClient.get[Json](s"/projects/$ref1", Bojack)(expect(StatusCodes.NotFound)) | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be able to run the test locally multiple times