-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-1135 Add experimental test mode and fix incomplete 'GROUP BY' quer…
…ies in PostgreSQL scenarios (Fix #1135)
- Loading branch information
Showing
11 changed files
with
163 additions
and
25 deletions.
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
58 changes: 58 additions & 0 deletions
58
.../src/integration/kotlin/com/reposilite/ReposiliteExperimentalIntegrationJunitExtension.kt
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,58 @@ | ||
/* | ||
* Copyright (c) 2022 dzikoysk | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.reposilite | ||
|
||
import org.junit.jupiter.api.extension.AfterEachCallback | ||
import org.junit.jupiter.api.extension.BeforeEachCallback | ||
import org.junit.jupiter.api.extension.Extension | ||
import org.junit.jupiter.api.extension.ExtensionContext | ||
import org.testcontainers.containers.PostgreSQLContainer | ||
import org.testcontainers.junit.jupiter.Container | ||
import org.testcontainers.junit.jupiter.Testcontainers | ||
import org.testcontainers.utility.DockerImageName | ||
|
||
/** | ||
* Integrations used in remote stack: | ||
* - PostreSQL | ||
* - Local file system | ||
*/ | ||
@Testcontainers | ||
internal class ReposiliteExperimentalIntegrationJunitExtension : Extension, BeforeEachCallback, AfterEachCallback { | ||
|
||
private class SpecifiedPostgreSQLContainer(image: String) : PostgreSQLContainer<SpecifiedPostgreSQLContainer>(DockerImageName.parse(image)) | ||
|
||
@Container | ||
private val postgres = SpecifiedPostgreSQLContainer("postgres:13.6") | ||
|
||
override fun beforeEach(context: ExtensionContext?) { | ||
postgres.start() | ||
|
||
context?.also { | ||
val instance = it.requiredTestInstance | ||
val type = instance::class.java | ||
|
||
type.getField("_extensionInitialized").set(instance, true) | ||
type.getField("_database").set(instance, "postgresql ${postgres.host}:${postgres.getMappedPort(5432)} ${postgres.databaseName} ${postgres.username} ${postgres.password}") | ||
type.getField("_storageProvider").set(instance, "fs") | ||
} | ||
} | ||
|
||
override fun afterEach(context: ExtensionContext) { | ||
postgres.stop() | ||
} | ||
|
||
} |
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
24 changes: 24 additions & 0 deletions
24
.../kotlin/com/reposilite/statistics/infrastructure/ExperimentalStatisticsIntegrationTest.kt
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,24 @@ | ||
/* | ||
* Copyright (c) 2022 dzikoysk | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.reposilite.statistics.infrastructure | ||
|
||
import com.reposilite.ReposiliteExperimentalIntegrationJunitExtension | ||
import com.reposilite.statistics.StatisticsIntegrationTest | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
|
||
@ExtendWith(ReposiliteExperimentalIntegrationJunitExtension::class) | ||
internal class ExperimentalStatisticsIntegrationTest : StatisticsIntegrationTest() |
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
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
Binary file modified
BIN
+357 Bytes
(120%)
reposilite-backend/src/test/workspace/plugins/example-plugin.jar
Binary file not shown.
Binary file modified
BIN
+359 Bytes
(100%)
reposilite-backend/src/test/workspace/plugins/groovy-plugin.jar
Binary file not shown.
Binary file modified
BIN
+362 Bytes
(100%)
reposilite-backend/src/test/workspace/plugins/javadoc-plugin.jar
Binary file not shown.