forked from apache/incubator-kie-kogito-serverless-operator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from rgdoliveira/sync_main
Sync main branch with Apache main branch
- Loading branch information
Showing
9 changed files
with
226 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,5 @@ Dockerfile | |
/.vscode/ | ||
/target/ | ||
|
||
database/index.db | ||
e2e-test-report.xml |
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
27 changes: 27 additions & 0 deletions
27
controllers/profiles/common/persistence/persistence_suite_test.go
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,27 @@ | ||
// Copyright 2024 Apache Software Foundation (ASF) | ||
// | ||
// 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 persistence | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestPersistence(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Persistence Suite") | ||
} |
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
146 changes: 146 additions & 0 deletions
146
controllers/profiles/common/persistence/postgresql_test.go
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,146 @@ | ||
// Copyright 2024 Apache Software Foundation (ASF) | ||
// | ||
// 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 persistence | ||
|
||
import ( | ||
operatorapi "github.com/apache/incubator-kie-kogito-serverless-operator/api/v1alpha08" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
const ( | ||
primaryPostgreSQLJdbc = "jdbc:postgresql://host:port/database?currentSchema=primary-database" | ||
|
||
platformPostgreSQLJdbc = "jdbc:postgresql://host:port/database?currentSchema=platform-database" | ||
schemaName = "my-schema" | ||
) | ||
|
||
var ( | ||
primaryPostgreSQLSecret = operatorapi.PostgreSQLSecretOptions{ | ||
Name: "primary-secret", | ||
} | ||
primaryPostreSQLService = operatorapi.PostgreSQLServiceOptions{ | ||
SQLServiceOptions: &operatorapi.SQLServiceOptions{Name: "primary-service"}, | ||
DatabaseSchema: "primary-schema", | ||
} | ||
plaformPostgreSQLSecret = operatorapi.PostgreSQLSecretOptions{ | ||
Name: "platform-secret", | ||
} | ||
platformPostreSQLService = operatorapi.SQLServiceOptions{ | ||
Name: "platform-service", | ||
} | ||
) | ||
|
||
var _ = Describe("RetrievePostgreSQLConfiguration", func() { | ||
DescribeTable("calculation", | ||
func(primary *operatorapi.PersistenceOptionsSpec, | ||
platformPersistence *operatorapi.PlatformPersistenceOptionsSpec, | ||
schema string, | ||
expectedConfig *operatorapi.PersistenceOptionsSpec) { | ||
result := RetrievePostgreSQLConfiguration(primary, platformPersistence, schema) | ||
Expect(expectedConfig).To(Equal(result)) | ||
}, | ||
Entry("primary is postgresql with JdbcUrl", buildPrimaryIsPostgreSQLWithJdbcUrl(), | ||
buildPlatformIsPostgreSQLWithJdbcUrl(), | ||
schemaName, | ||
buildPrimaryIsPostgreSQLWithJdbcUrl()), | ||
Entry("primary is postgresql ServiceRef", buildPrimaryIsPostgreSQLWithServiceRef(), | ||
buildPlatformIsPostgreSQLWithJdbcUrl(), | ||
schemaName, | ||
buildPrimaryIsPostgreSQLWithServiceRef()), | ||
Entry("primary is nil, platform with JdbcUrl", | ||
nil, | ||
buildPlatformIsPostgreSQLWithJdbcUrl(), | ||
schemaName, | ||
&operatorapi.PersistenceOptionsSpec{ | ||
PostgreSQL: &operatorapi.PersistencePostgreSQL{ | ||
SecretRef: plaformPostgreSQLSecret, | ||
JdbcUrl: platformPostgreSQLJdbc, | ||
}, | ||
}), | ||
Entry("primary is empty, platform with JdbcUrl", | ||
&operatorapi.PersistenceOptionsSpec{}, | ||
buildPlatformIsPostgreSQLWithJdbcUrl(), | ||
schemaName, | ||
&operatorapi.PersistenceOptionsSpec{ | ||
PostgreSQL: &operatorapi.PersistencePostgreSQL{ | ||
SecretRef: plaformPostgreSQLSecret, | ||
JdbcUrl: platformPostgreSQLJdbc, | ||
}, | ||
}), | ||
Entry("primary is nil, platform with ServiceRef", | ||
nil, | ||
buildPlatformIsPostgreSQLWithServiceRef(), | ||
schemaName, | ||
&operatorapi.PersistenceOptionsSpec{ | ||
PostgreSQL: &operatorapi.PersistencePostgreSQL{ | ||
ServiceRef: &operatorapi.PostgreSQLServiceOptions{ | ||
SQLServiceOptions: &platformPostreSQLService, | ||
DatabaseSchema: schemaName, | ||
}, | ||
SecretRef: plaformPostgreSQLSecret, | ||
}, | ||
}), | ||
Entry("primary is empty, platform with ServiceRef", | ||
&operatorapi.PersistenceOptionsSpec{}, | ||
buildPlatformIsPostgreSQLWithServiceRef(), | ||
schemaName, | ||
&operatorapi.PersistenceOptionsSpec{ | ||
PostgreSQL: &operatorapi.PersistencePostgreSQL{ | ||
ServiceRef: &operatorapi.PostgreSQLServiceOptions{ | ||
SQLServiceOptions: &platformPostreSQLService, | ||
DatabaseSchema: schemaName, | ||
}, | ||
SecretRef: plaformPostgreSQLSecret, | ||
}, | ||
}), | ||
) | ||
}) | ||
|
||
func buildPrimaryIsPostgreSQLWithJdbcUrl() *operatorapi.PersistenceOptionsSpec { | ||
return &operatorapi.PersistenceOptionsSpec{ | ||
PostgreSQL: &operatorapi.PersistencePostgreSQL{ | ||
JdbcUrl: primaryPostgreSQLJdbc, | ||
SecretRef: primaryPostgreSQLSecret, | ||
}, | ||
} | ||
} | ||
|
||
func buildPrimaryIsPostgreSQLWithServiceRef() *operatorapi.PersistenceOptionsSpec { | ||
return &operatorapi.PersistenceOptionsSpec{ | ||
PostgreSQL: &operatorapi.PersistencePostgreSQL{ | ||
ServiceRef: &primaryPostreSQLService, | ||
SecretRef: primaryPostgreSQLSecret, | ||
}, | ||
} | ||
} | ||
|
||
func buildPlatformIsPostgreSQLWithJdbcUrl() *operatorapi.PlatformPersistenceOptionsSpec { | ||
return &operatorapi.PlatformPersistenceOptionsSpec{ | ||
PostgreSQL: &operatorapi.PlatformPersistencePostgreSQL{ | ||
JdbcUrl: platformPostgreSQLJdbc, | ||
SecretRef: plaformPostgreSQLSecret, | ||
}, | ||
} | ||
} | ||
|
||
func buildPlatformIsPostgreSQLWithServiceRef() *operatorapi.PlatformPersistenceOptionsSpec { | ||
return &operatorapi.PlatformPersistenceOptionsSpec{ | ||
PostgreSQL: &operatorapi.PlatformPersistencePostgreSQL{ | ||
ServiceRef: &platformPostreSQLService, | ||
SecretRef: plaformPostgreSQLSecret, | ||
}, | ||
} | ||
} |
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 |
---|---|---|
@@ -1,10 +1,21 @@ | ||
# Requirements for cekit 4.11.0 build | ||
# see: https://pip.pypa.io/en/stable/reference/requirements-file-format/ | ||
docker-squash | ||
odcs | ||
docker | ||
|
||
requests<2.32.0 | ||
cekit==4.11.0 | ||
behave==1.2.6 | ||
lxml==5.2.1 | ||
docker==7.0.0 | ||
docker-squash==1.2.0 | ||
python-docker | ||
elementpath==4.4.0 | ||
pyyaml==6.0.1 | ||
ruamel.yaml==0.18.6 | ||
python-dateutil==2.9.0.post0 | ||
Jinja2==3.1.4 | ||
pykwalify==1.8.0 | ||
colorlog==6.8.2 | ||
click==8.1.7 | ||
odcs | ||
behave | ||
lxml | ||
krb5 | ||
cekit == 4.11.0 |
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