0
0
Microservicessystem_design~10 mins

Test environments and data in Microservices - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the environment used for testing microservices.

Microservices
environment = "[1]"
Drag options to blanks, or click blank then click option'
Atesting
Bproduction
Cdevelopment
Dstaging
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'production' instead of 'testing' environment.
Confusing 'development' with 'testing' environment.
2fill in blank
medium

Complete the code to select the appropriate data type for test data isolation in microservices.

Microservices
test_data_type = "[1]"
Drag options to blanks, or click blank then click option'
Aarchived
Bshared
Clive
Disolated
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'shared' test data causing test interference.
Using 'live' data risking production data corruption.
3fill in blank
hard

Fix the error in the test environment setup code to correctly configure the database URL.

Microservices
db_url = "jdbc:mysql://[1]:3306/testdb"
Drag options to blanks, or click blank then click option'
Aprod-db-server
Blocalhost
Ctest-db-server
Ddev-db-server
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'prod-db-server' in test environment causing data risks.
Using 'localhost' when tests require a dedicated test database.
4fill in blank
hard

Fill both blanks to create a test data setup that resets and seeds the database before tests.

Microservices
def setup_test_data():
    [1]()
    [2]()
Drag options to blanks, or click blank then click option'
Areset_database
Bseed_database
Cbackup_database
Dconnect_database
Attempts:
3 left
💡 Hint
Common Mistakes
Calling backup or connect functions instead of reset and seed.
Reversing the order of reset and seed functions.
5fill in blank
hard

Fill all three blanks to configure environment variables for test microservice deployment.

Microservices
config = {
    "ENV": "[1]",
    "DB_HOST": "[2]",
    "LOG_LEVEL": "[3]"
}
Drag options to blanks, or click blank then click option'
Atesting
Btest-db-server
CDEBUG
Dproduction
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'production' environment in test config.
Setting log level to INFO or ERROR instead of DEBUG.