Add New MockGCP Resource

Create mock GCP services with resource controllers and normalized logs.

1.1k|367|Updated Apr 8, 2019
One-click install
npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill add-new-mockgcp-resource
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Add New MockGCP Resource
Source: https://github.com/GoogleCloudPlatform/k8s-config-connector/tree/main/.gemini/skills/add-new-mockgcp-resource
Command: npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill add-new-mockgcp-resource

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Teams need a reliable way to extend mock GCP behavior so tests and development can exercise new GCP APIs without hitting real endpoints, while keeping logs and recorded expectations stable over time.

Core Features & Use Cases

  • Workflow-driven implementation: Provides a step-by-step process to identify the target service and protos, add generation paths when necessary, and create the required mock service and controller code.
  • Deterministic HTTP-to-gRPC wiring: Guides how to implement the mock service using grpc-gateway patterns and register the proper clients and operation/LRO routes.
  • Stable, scoped golden logs: Instructs how to implement normalize.go with service-host scoping so test fixtures remain consistent and avoid cross-service log corruption.
  • Test alignment loop: Recommends capturing real GCP fixtures and iteratively comparing mock behavior until discrepancies are resolved.

Quick Start

Ask for guidance to add support for a new Memcache-related mock resource by following the service/proto identification, implementing service.go and the resource CRUD controller, then running record-gcp and compare-mock to validate and normalize logs.

Frequently Asked Questions about Add New MockGCP Resource

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a mock GCP service for local testing in Go?

You create a mock GCP service by implementing service.go and resource CRUD controllers under mockgcp, registering proper clients, and validating against recorded fixtures. This enables reliable local testing without hitting real endpoints.

How do I handle Long-Running Operations when mocking GCP APIs?

Mocking Long-Running Operations involves implementing optional LRO routes within your mock service.go file using grpc-gateway patterns. You register the proper operation routes alongside standard resource CRUD handlers to support asynchronous API behaviors.

Why do my mock GCP test fixtures have unstable logs across services?

Cross-service log corruption occurs when normalization is not properly scoped. You must implement normalize.go with Previsit scoped specifically to the service host so test fixtures remain consistent and avoid cross-service log corruption.

What's the best way to validate a new mock GCP resource against real endpoints?

The best way to validate a new mock GCP resource is capturing real GCP fixtures using record-gcp, then iteratively comparing mock behavior with compare-mock until discrepancies are resolved and expectations match.

Do I need published proto definitions to add a new mocked GCP endpoint?

Yes, adding new mocked endpoints backed by published proto definitions is required. You identify the target service and protos first, adding generation paths when necessary before creating the mock service and controller code.

What is mockgcp and when do I need it for GCP API development?

Mockgcp is a framework for extending mock GCP behavior so tests and development can exercise new GCP APIs locally. You need it when teams require reliable local testing without hitting real endpoints while keeping logs stable.