0

我有这个我正在尝试检查的测试,但似乎 EnableIAMDatabaseAuthentication 没有被传递给 moto

@mock_rds
def test_iam_database_authentication_enabled(self):
    print(self.client.create_db_instance(
        DBInstanceIdentifier='db-master-1',
        AllocatedStorage=10,
        Engine='postgres',
        DBInstanceClass='db.m1.small',
        EnableIAMDatabaseAuthentication=True,
        MasterUsername='root',
        MasterUserPassword='hunter2',
        Port=1234,
    ))

{'DBInstance':{'DBInstanceIdentifier':'db-master-1','DBInstanceClass':'db.m1.small','Engine':'postgres','DBInstanceStatus':'available','MasterUsername': 'root', 'Endpoint': {'Address': 'db-master-1.aaaaaaaaaa.us-east-2.rds.amazonaws.com', 'Port': 1234}, 'AllocatedStorage': 10, 'InstanceCreateTime ': datetime.datetime(2020, 1, 13, 13, 1, 10, 665000, tzinfo=tzutc()), 'PreferredBackupWindow': '03:50-04:20', 'BackupRetentionPeriod': 1, 'DBSecurityGroups' :[],'VpcSecurityGroups':[],'DBParameterGroups':[{'DBParameterGroupName':'default.postgres9.3','ParameterApplyStatus':'同步中'}],'PreferredMaintenanceWindow': 'wed:06:38-wed:07:08', 'MultiAZ': False, 'EngineVersion': '9.3.3', 'AutoMinorVersionUpgrade': False, 'ReadReplicaDBInstanceIdentifiers': [], 'LicenseModel': 'general-public-license', 'OptionGroupMemberships': [{'OptionGroupName': 'default.postgres9.3', 'Status': 'in-sync'}], 'PubliclyAccessible': False, 'StatusInfos': [] , 'StorageType': 'gp2', 'StorageEncrypted': False, 'DbiResourceId': 'db-M5ENSHXFPU6XHZ4G4ZEI5QIO2U', 'CopyTagsToSnapshot': False, 'DBInstanceArn': 'arn:aws:rds:us-east-2:1234567890: db:db-master-1', 'IAMDatabaseAuthenticationEnabled': False}, 'ResponseMetadata': {'RequestId':'523e3218-afc7-11c3-90f5-f90431260ab4', 'HTTPStatusCode': 200, 'HTTPHeaders': {'server': 'amazon.com'}, 'RetryAttempts': 0}}

尝试传递 EnableIAMDatabaseAuthentication 参数时我做错了吗?它应该设置:IAMDatabaseAuthenticationEnabled

4

1 回答 1

0

我可以确认 moto 库本身没有从moto 库中的这行代码传递 EnableIAMDatabaseAuthentication 参数。

但是,我从上面的链接中得出结论,而不是查看 create_db_instance 函数的返回值,因为我查看了boto3 rds reference,它的响应值无论如何都不会返回 EnableIAMDatabaseAuthentication 。

您没有做错任何事情,该值只是在 boto3 的响应中不存在。即使有一天 moto 确实传入了那个参数,它也不会在 boto3 之前出现。其中一个例子是 MasterUserPassword 参数,moto 确实通过了它,但 boto3 没有在响应中包含它。

于 2020-01-13T22:52:02.607 回答