[英]GCP Database migration service for Postgres - how to migrate a database with a name other than "postgres"?
[英]How to know mock postgres host name?
我正在嘗試使用moto在 python aws lambda proyect 上創建一些單元測試。 我使用以下方法創建了一個 rds postgres 實例:
@pytest.fixture(scope='function')
def rds(aws_credentials):
with mock_rds():
yield boto3.client("rds", region_name="us-west-2").create_db_instance(
DBInstanceIdentifier="db-master-1",
AllocatedStorage=10,
Engine="postgres",
DBName="fox-postgres",
DBInstanceClass="db.m1.small",
LicenseModel="license-included",
MasterUsername="postgres",
MasterUserPassword="postgres",
Port=5432,
DBSecurityGroups=["my_sg"],
VpcSecurityGroupIds=["sg-123456"],
EnableCloudwatchLogsExports=["audit", "error"],
)
我如何知道(或設置)主機名以便運行查詢? 這可能嗎? 我不知道這是否是一個真實的(或幾乎)數據庫實例。
提前致謝。
不可能針對 Moto 運行實際查詢 - RDS 響應是完全模擬的。
Moto 的describe_db_instances
-方法確實在Endpoint.Address
-屬性中返回一個端點,但這是硬編碼的 - 請參閱https://github.com/getmoto/moto/blob/339309c9af4188006d9592469d52193f57249b1e/moto/rds/models.py#L674
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.