Module tests.AwsRdsClusterOperatorTest
AwsRdsClusterOperatorTest module.
Copyright: ycookjp
Note
RDSのAWS clientのモックは、RDSのインスタンス1つしかサポートしないため、 テストでは有効なインスタンスが常に1つであるようにシナリオを構成している。
Classes
class AwsRdsClusterOperatorTest (methodName='runTest')-
AwsRdsClusterOperator クラス用のテストクラス
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
Ancestors
- unittest.case.TestCase
Static methods
def setUpClass()-
テストクラスの set up を実行します。
Args
cls- テストクラスのインスタンス
def tearDownClass()-
テストクラスの tear down を実行します。
Args
cls- テストクラスのインスタンス
Methods
def test_error_start_stop(self)-
存在しないRDS DB clusterのIDを指定して、startメソッド、stopメソッドのテストを実行します。
テスト内容は、以下のとおりです。
- 存在しないのRDS DB clusterのIDを指定して、stopメソッドを実行する。
- => 例外が発生すること。
- 存在しないのRDS DB clusterのIDを指定して、startメソッドを開始する。
- => 例外が発生すること。
- 存在しないのRDS DB clusterのIDを指定して、stopメソッドを実行する。
def test_error_start_stop_resources(self)-
存在しないRDS DB ClusterのIDを含むRDS DB clusterの配列を指定してstart_resourcesメソッド、stop_resourcesメソッドのテストを実行します。
テストの内容は、以下のとおりです。
- 存在しないRDS DB cliuster1つと実行中のRDS DB cluster1つのIDを指定
して、stop_resourcesメソッド実行する。
- => 例外が発生すること。
- => 存在するRDS DB instanceのステータスが「stopping」または「stopped」 であること。
- 存在しないRDS DB cliuster1つと停止中のRDS DB cluster1つのIDを指定
して、stop_resourcesメソッドを実行する。
- => 例外が発生すること。
- => 存在するRDS DB instanceのステータスが「stopping」または「stopped」 であること。
- 存在しないRDS DB cliuster1つと停止中のRDS DB cluster1つのIDを指定
して、start_resourcesメソッドを実行する。
- => 例外が発生すること。
- => 存在するRDS DB instanceのステータスがavailableであること。
- 存在しないRDS DB cliuster1つと実行中のRDS DB cluster1つのIDを指定
して、start_resourcesメソッドを実行する。
- => 例外が発生すること。
- => RDS DB clusterのステータスがavailableであること。
- 存在しないRDS DB cliuster1つと実行中のRDS DB cluster1つのIDを指定
して、stop_resourcesメソッド実行する。
def test_start_stop(self)-
startメソッド、stopメソッドのテストを実行します。
テストの内容は、以下のとおりです。
- 実行中のRDS DB clusterのIDを指定して、stopメソッドを実行する。
- => 停止操作したRDS DB clusterの個数が1であること。
- => RDS DB clusterのステータスが「stopping」または「stopped」と なること。
- 停止中のRDS DB clusterのIDを指定して、stopメソッドを開始する。
- => 停止操作したRDS DB clusterの個数が0であること。
- => RDS DB clusterのステータスが「stopping」または「stopped」と なること。
- 停止中のRDS DB clusterのIDを指定して、startメソッドを開始する。
- => 開始操作したRDS DB clusterの個数が1であること。
- => RDS DB clusterのステータスが「available」であること。
- 実行中のRDS DB clusterのIDを指定して、startメソッドを開始する。
- => 開始操作したRDS DB clusterの個数が0であること。
- => RDS DB clusterステータスが「available」であること。
- 実行中のRDS DB clusterのIDを指定して、stopメソッドを実行する。
def test_start_stop_resources(self)-
start_resourcesメソッド、stop_resourcesメソッドのテストを実行します。
テストの内容は、以下のとおりです。
- 実行中のRDS DB cluster1つのIDを指定して、stop_resourcesメソッドを
実行する。
- => 停止操作したRDS DB cluserの個数は1であること。
- => RDS DB instanceのステータスが「stopping」または「stopped」で あること。
- 停止中のRDS DB cluster1つのIDを指定して、stop_resourcesメソッドを
実行する。
- => 停止操作したRDS DB cluserの個数は0であること。
- => RDS DB instanceのステータスが「stopping」または「stopped」で あること。
- 停止中のRDS DB cluster1つのIDを指定して、start_resourcesメソッドを
実行する。
- => 開始操作したRDS DB clusterの個数が1であること。
- => RDS DB clusterのステータスがavailableであること。
- 実行中のRDS DB cluster1つのIDを指定して、start_resourcesメソッドを
実行する。
- => 開始操作したRDS DB clusterの個数が0であること。
- => RDS DB clusterのステータスがavailableであること。
- 実行中のRDS DB cluster1つのIDを指定して、stop_resourcesメソッドを
実行する。