GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice question 9 of 35

You are developing an application that reads credit card data from a Pub/Sub subscription. You have written code and completed unit testing. You need to test the Pub/Sub integration before deploying to Google Cloud. What should you do?

Full set: 265 questions
Answer options
A: Create a service to publish messages, and deploy the Pub/Sub emulator. Generate random content in the publishing service, and publish to the emulator.
B: Create a service to publish messages to your application. Collect the messages from Pub/Sub in production, and replay them through the publishing service.
C: Create a service to publish messages, and deploy the Pub/Sub emulator. Collect the messages from Pub/Sub in production, and publish them to the emulator.
D: Create a service to publish messages, and deploy the Pub/Sub emulator. Publish a standard set of testing messages from the publishing service to the emulator. Correct answer
Correct Answer:
D. Create a service to publish messages, and deploy the Pub/Sub emulator. Publish a standard set of testing messages from the publishing service to the emulator.
Explanation

The question requires a method for testing Pub/Sub integration locally before deploying to the cloud. The official Google Cloud Pub/Sub emulator is designed for this exact purpose, allowing developers to test their application's interaction with the Pub/Sub API without incurring costs or affecting production systems. Using a "standard set of testing messages" is a fundamental software testing best practice. It ensures that tests are deterministic, repeatable, and cover known edge cases. This approach is superior to using random data and avoids the severe security and compliance risks associated with using sensitive production data (like credit card numbers) in a non-production environment.

Why Incorrect

A. Generating random content is a poor testing practice because it makes tests non-deterministic, and failures become difficult to reproduce and debug.
B. Using live production data, especially sensitive credit card data, for testing is a major security risk and a direct violation of compliance standards like PCI-DSS.
C. This option is also incorrect because it uses sensitive production data for testing, which is a severe security and compliance violation, regardless of using an emulator.

References

1. Google Cloud Documentation, "Testing apps locally with the emulator": "The Pub/Sub emulator provides local emulation of the Pub/Sub service. You can use the emulator to develop and test your application locally, without creating a Google Cloud project or a billing account." This supports using the emulator for pre-deployment testing.

Source: Google Cloud Documentation, Pub/Sub > Docs > How-to guides > Testing apps locally with the emulator.

2. Google Cloud Whitepaper, "PCI Data Security Standard Compliance on Google Cloud": This document outlines the shared responsibility model for PCI-DSS. Requirement 6.4.3 of the PCI-DSS standard explicitly states, "Production data (live PANs) are not used for testing or development." This directly invalidates options B and C.

Source: Google Cloud Security Compliance Documentation, PCI-DSS, Requirement 6.4.3.

3. MIT OpenCourseWare, "6.170 Software Studio, Lecture 10: Testing": University courseware on software engineering emphasizes that good testing relies on carefully chosen inputs with known, expected outputs. This principle supports using a "standard set of testing messages" (Option D) over random data (Option A) to create effective and repeatable tests.

Source: MIT OpenCourseWare, Electrical Engineering and Computer Science, 6.170 Software Studio, Fall 2005, Lecture 10 Notes.

Scroll to Top