Skip to content

Conversation

@tzvatot
Copy link
Contributor

@tzvatot tzvatot commented Dec 30, 2025

Summary

This PR adds automated e2e tests for compute instance operations.

Changes

  • Add ComputeInstanceScenario infrastructure for organizing test data
  • Add MockComputeInstancesServer and MockComputeInstanceTemplatesServer
  • Add e2e test that validates create, list, get, and delete operations
  • Return NotFound errors for non-existent resources instead of dummy data

Testing

The e2e test validates the complete CRUD lifecycle:

  1. Lists templates to get a valid template ID
  2. Lists existing instances (baseline count)
  3. Creates a new compute instance
  4. Verifies the instance appears in list
  5. Gets the created instance by ID
  6. Deletes the instance
  7. Verifies the instance was deleted

🤖 Generated with Claude Code

This change enhances the test server to support compute instance and
template mocking using YAML-based test data, making it easier to test
the CLI against realistic compute instance scenarios.

Changes:
- Add ComputeInstanceScenario infrastructure to load test data from YAML
- Add compute-instances-and-templates.yaml with sample instances/templates
- Update test server to use scenario data for compute instance operations
- Return NotFound errors for non-existent resources instead of dummy data
- Add CEL filter support for deletion_timestamp queries in List operations

Example usage with test server:

```
$ ./fulfillment-cli get computeinstances
ID             NAME           TEMPLATE        STATE        EXTERNAL IP
ci-mock-12345  mock-instance  small-instance  READY        192.168.1.100
ci-mock-67890  test-instance  large-instance  PROGRESSING  192.168.1.101

$ ./fulfillment-cli describe computeinstance ci-mock-12345
ID:        ci-mock-12345
Template:  tpl-small-001
State:     READY

$ ./fulfillment-cli describe computeinstance nonexistent
Error: failed to describe compute instance: rpc error: code = NotFound desc = compute instance "nonexistent" not found

$ ./fulfillment-cli get computeinstancetemplates
ID             NAME            TITLE
tpl-small-001  small-instance  Small Instance Template
tpl-large-001  large-instance  Large Instance Template

$ ./fulfillment-cli create computeinstance --template tpl-large-001 --name new-test-instance
Created compute instance 'ci-mock-12345'.
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@tzvatot tzvatot marked this pull request as draft December 30, 2025 11:07
This change adds proper automated testing for compute instance operations
and removes the manual test server implementation that was added in the
previous commit.

Changes:
- Add MockComputeInstancesServer for automated testing
- Add MockComputeInstanceTemplatesServer for automated testing
- Add e2e test that verifies create, list, get, and delete operations
- Remove compute instance handling from test-server
- Remove compute-instances-and-templates.yaml (not needed)

The e2e test validates the complete CRUD lifecycle:
1. Lists templates to get a valid template ID
2. Lists existing instances (initial count)
3. Creates a new compute instance
4. Verifies the instance appears in list (count increased)
5. Gets the created instance by ID
6. Deletes the instance
7. Verifies the instance was deleted (count back to initial)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants