Skip to content

Commit eb32851

Browse files
committed
Bug Fix - BaseDB CP - Fixing Integration Tests: Database Upgrade & Database Upgrade from Database Software Image
1 parent 91aab12 commit eb32851

File tree

14 files changed

+864
-256
lines changed

14 files changed

+864
-256
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# $Header$
2+
#
3+
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
4+
#
5+
# NAME
6+
# data.tf
7+
#
8+
# USAGE
9+
# Use the following path for the Example & Backward Compatibility tests: database/db_systems/db_vm/db_upgrade
10+
# NOTES
11+
# Terraform Integration Test: TestDatabaseDatabaseUpgradeResource_basic
12+
#
13+
# FILE(S)
14+
# database_database_upgrade_test.go
15+
#
16+
# MODIFIED MM/DD/YY
17+
# escabrer 12/13/2024 - Created
18+
19+
20+
data "oci_identity_availability_domains" "test_availability_domains" {
21+
compartment_id = var.tenancy_ocid
22+
}
23+
24+
data "oci_database_db_systems" "test_db_system_for_upgrade" {
25+
compartment_id = var.compartment_id
26+
filter {
27+
name = "id"
28+
values = [oci_database_db_system.test_db_system_for_upgrade.id]
29+
}
30+
}
31+
32+
data "oci_database_db_homes" "test_db_system_for_upgrade" {
33+
compartment_id = var.compartment_id
34+
db_system_id = oci_database_db_system.test_db_system_for_upgrade.id
35+
}
36+
37+
data "oci_database_db_home" "test_db_system_for_upgrade" {
38+
db_home_id = data.oci_database_db_homes.test_db_system_for_upgrade.db_homes.0.db_home_id
39+
}
40+
41+
data "oci_database_databases" "test_db_system_for_upgrade" {
42+
compartment_id = var.compartment_id
43+
db_home_id = data.oci_database_db_homes.test_db_system_for_upgrade.db_homes.0.db_home_id
44+
}
45+
46+
data "oci_database_database" "test_db_system_for_upgrade" {
47+
database_id = data.oci_database_databases.test_db_system_for_upgrade.databases.0.id
48+
}
49+
50+
51+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# $Header$
2+
#
3+
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
4+
#
5+
# NAME
6+
# main.tf
7+
#
8+
# USAGE
9+
# Use the following path for the Example & Backward Compatibility tests: database/db_systems/db_vm/db_upgrade
10+
# NOTES
11+
# Terraform Integration Test: TestDatabaseDatabaseUpgradeResource_basic
12+
#
13+
# FILE(S)
14+
# database_database_upgrade_test.go
15+
#
16+
# MODIFIED MM/DD/YY
17+
# escabrer 12/13/2024 - Created
18+
19+
20+
21+
resource "oci_database_db_system" "test_db_system_for_upgrade" {
22+
availability_domain = data.oci_identity_availability_domains.test_availability_domains.availability_domains.0.name
23+
compartment_id = var.compartment_id
24+
data_storage_size_in_gb = "256"
25+
database_edition = "ENTERPRISE_EDITION"
26+
db_home {
27+
database {
28+
admin_password = var.admin_password
29+
character_set = "AL32UTF8"
30+
db_name = "tfDb"
31+
db_workload = "OLTP"
32+
ncharacter_set = "AL16UTF16"
33+
pdb_name = "tfPdb"
34+
}
35+
db_version = "12.2.0.1"
36+
display_name = "tfDbHome"
37+
}
38+
db_system_options {
39+
storage_management = "LVM"
40+
}
41+
disk_redundancy = "NORMAL"
42+
display_name = "tfDbSystemForUpgradeExample"
43+
domain = oci_core_subnet.test_subnet.subnet_domain_name
44+
fault_domains = ["FAULT-DOMAIN-1"]
45+
hostname = "tf-db-host"
46+
license_model = "LICENSE_INCLUDED"
47+
lifecycle {
48+
ignore_changes = [db_home[0].db_version, defined_tags]
49+
}
50+
node_count = "1"
51+
nsg_ids = [oci_core_network_security_group.test_nsg.id]
52+
shape = "VM.Standard2.2"
53+
ssh_public_keys = [var.ssh_public_key]
54+
subnet_id = oci_core_subnet.test_subnet.id
55+
}
56+
57+
resource "oci_database_database_upgrade" "test_database_precheck" {
58+
action = "PRECHECK"
59+
database_id = data.oci_database_databases.test_db_system_for_upgrade.databases.0.id
60+
database_upgrade_source_details {
61+
db_version = "19.24.0.0"
62+
source = "DB_VERSION"
63+
}
64+
}
65+
66+
resource "oci_database_database_upgrade" "test_database_upgrade" {
67+
action = "UPGRADE"
68+
database_id = data.oci_database_databases.test_db_system_for_upgrade.databases.0.id
69+
database_upgrade_source_details {
70+
db_version = "19.24.0.0"
71+
options = "-upgradeTimezone false -keepEvents"
72+
source = "DB_VERSION"
73+
}
74+
depends_on = [oci_database_database_upgrade.test_database_precheck]
75+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# $Header$
2+
#
3+
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
4+
#
5+
# NAME
6+
# network.tf
7+
#
8+
# USAGE
9+
# Use the following path for the Example & Backward Compatibility tests: database/db_systems/db_vm/db_upgrade
10+
# NOTES
11+
# Terraform Integration Test: TestDatabaseDatabaseUpgradeResource_basic
12+
#
13+
# FILE(S)
14+
# database_database_upgrade_test.go
15+
#
16+
# MODIFIED MM/DD/YY
17+
# escabrer 12/13/2024 - Created
18+
19+
20+
resource "oci_core_vcn" "test_vcn" {
21+
cidr_block = "10.1.0.0/16"
22+
compartment_id = var.compartment_id
23+
display_name = "tfVcn"
24+
dns_label = "tfvcn"
25+
}
26+
27+
resource "oci_core_route_table" "test_route_table" {
28+
compartment_id = var.compartment_id
29+
display_name = "tfRouteTable"
30+
route_rules {
31+
cidr_block = "0.0.0.0/0"
32+
description = "Internal traffic for OCI Services"
33+
network_entity_id = oci_core_internet_gateway.test_internet_gateway.id
34+
}
35+
vcn_id = oci_core_vcn.test_vcn.id
36+
}
37+
38+
resource "oci_core_internet_gateway" "test_internet_gateway" {
39+
compartment_id = var.compartment_id
40+
display_name = "tfInternetGateway"
41+
vcn_id = oci_core_vcn.test_vcn.id
42+
}
43+
44+
resource "oci_core_subnet" "test_subnet" {
45+
cidr_block = "10.1.20.0/24"
46+
compartment_id = var.compartment_id
47+
dhcp_options_id = oci_core_vcn.test_vcn.default_dhcp_options_id
48+
display_name = "tfSubnet"
49+
dns_label = "tfsubnet"
50+
route_table_id = oci_core_route_table.test_route_table.id
51+
security_list_ids = [oci_core_vcn.test_vcn.default_security_list_id]
52+
vcn_id = oci_core_vcn.test_vcn.id
53+
}
54+
55+
resource "oci_core_network_security_group" "test_nsg" {
56+
compartment_id = var.compartment_id
57+
display_name = "tfNsg"
58+
vcn_id = oci_core_vcn.test_vcn.id
59+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# $Header$
2+
#
3+
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
4+
# NAME
5+
# provider.tf
6+
#
7+
# USAGE
8+
# Use the following path for the Example & Backward Compatibility tests: database/db_systems/db_vm/db_upgrade
9+
#
10+
# NOTES
11+
# Terraform Integration Test: TestDatabaseDatabaseUpgradeResource_basic
12+
#
13+
# FILE(S)
14+
# database_database_upgrade_test.go
15+
#
16+
# MODIFIED MM/DD/YY
17+
# escabrer 12/13/2024 - Created
18+
19+
20+
provider "oci" {
21+
auth = "SecurityToken"
22+
config_file_profile = "terraform-federation-test"
23+
region = var.region
24+
tenancy_ocid = var.compartment_id
25+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# $Header$
2+
#
3+
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
4+
#
5+
# NAME
6+
# tags.tf
7+
#
8+
# USAGE
9+
# Use the following path for the Example & Backward Compatibility tests: database/db_systems/db_vm/db_upgrade
10+
# NOTES
11+
# Terraform Integration Test: TestDatabaseDatabaseUpgradeResource_basic
12+
#
13+
# FILE(S)
14+
# database_database_upgrade_test.go
15+
#
16+
# MODIFIED MM/DD/YY
17+
# escabrer 12/13/2024 - Created
18+
19+
20+
resource "oci_identity_tag_namespace" "tag-namespace1" {
21+
#Required
22+
compartment_id = var.tenancy_ocid
23+
description = "example tag namespace"
24+
name = var.defined_tag_namespace_name != "" ? var.defined_tag_namespace_name : "example-tag-namespace-all"
25+
26+
is_retired = false
27+
}
28+
29+
resource "oci_identity_tag" "tag1" {
30+
#Required
31+
description = "example tag"
32+
name = "example-tag"
33+
tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id
34+
35+
is_retired = false
36+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# $Header$
2+
#
3+
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
4+
# NAME
5+
# variables.tf
6+
#
7+
# USAGE
8+
# Use the following path for the Example & Backward Compatibility tests: database/db_systems/db_vm/db_upgrade
9+
#
10+
# NOTES
11+
# Terraform Integration Test: TestDatabaseDatabaseUpgradeResource_basic
12+
#
13+
# FILE(S)
14+
# database_database_upgrade_test.go
15+
#
16+
# MODIFIED MM/DD/YY
17+
# escabrer 12/13/2024 - Created
18+
19+
20+
variable "tenancy_ocid" {
21+
type = string
22+
}
23+
24+
variable "region" {
25+
type = string
26+
}
27+
28+
variable "defined_tag_namespace_name" {
29+
default = ""
30+
}
31+
32+
variable "compartment_id" {
33+
type = string
34+
}
35+
36+
variable "ssh_public_key" {
37+
type = string
38+
}
39+
40+
variable "admin_password" {
41+
type = string
42+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# $Header$
2+
#
3+
# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
4+
#
5+
# NAME
6+
# data.tf
7+
#
8+
# USAGE
9+
# Use the following path for the Example & Backward Compatibility tests: database/db_systems/db_vm/db_upgrade_from_database_software_image
10+
# NOTES
11+
# Terraform Integration Test: TestDatabaseDatabaseUpgradeResource_DbSoftwareImage
12+
#
13+
# FILE(S)
14+
# database_database_upgrade_resource_test.go
15+
#
16+
# MODIFIED MM/DD/YY
17+
# escabrer 12/16/2024 - Created
18+
19+
20+
data "oci_identity_availability_domains" "test_availability_domains" {
21+
compartment_id = var.tenancy_ocid
22+
}
23+
24+
data "oci_database_db_systems" "test_db_system_for_upgrade" {
25+
compartment_id = var.compartment_id
26+
filter {
27+
name = "id"
28+
values = [oci_database_db_system.test_db_system_for_upgrade.id]
29+
}
30+
}
31+
32+
data "oci_database_db_homes" "test_db_system_for_upgrade" {
33+
compartment_id = var.compartment_id
34+
db_system_id = oci_database_db_system.test_db_system_for_upgrade.id
35+
}
36+
37+
data "oci_database_db_home" "test_db_system_for_upgrade" {
38+
db_home_id = data.oci_database_db_homes.test_db_system_for_upgrade.db_homes.0.db_home_id
39+
}
40+
41+
data "oci_database_databases" "test_db_system_for_upgrade" {
42+
compartment_id = var.compartment_id
43+
db_home_id = data.oci_database_db_homes.test_db_system_for_upgrade.db_homes.0.db_home_id
44+
}
45+
46+
data "oci_database_database" "test_db_system_for_upgrade" {
47+
database_id = data.oci_database_databases.test_db_system_for_upgrade.databases.0.id
48+
}

0 commit comments

Comments
 (0)