|
| 1 | +# Codewise CLI Testing Runbook |
| 2 | + |
| 3 | +This runbook is designed for direct copy-paste testing from project root. |
| 4 | + |
| 5 | +## 1) Prerequisites |
| 6 | + |
| 7 | +Use these checks to confirm required tooling is available before running any workflow. |
| 8 | + |
| 9 | +```bash |
| 10 | +go version |
| 11 | +docker --version |
| 12 | +kubectl version --client |
| 13 | +helm version |
| 14 | +``` |
| 15 | + |
| 16 | +## 2) Build And Baseline Validation |
| 17 | + |
| 18 | +Build the binary, then verify command wiring and version output. |
| 19 | + |
| 20 | +```bash |
| 21 | +make clean |
| 22 | +make build |
| 23 | +./codewise-cli --help |
| 24 | +./codewise-cli version |
| 25 | +go run . --help |
| 26 | +go run . version |
| 27 | +``` |
| 28 | + |
| 29 | +## 3) Automated Tests |
| 30 | + |
| 31 | +Run the existing test suites first, then optional race and coverage checks. |
| 32 | + |
| 33 | +```bash |
| 34 | +make test |
| 35 | +go test ./... -v |
| 36 | +go test ./... -race |
| 37 | +go test ./... -coverprofile=coverage.out |
| 38 | +go tool cover -func=coverage.out |
| 39 | +``` |
| 40 | + |
| 41 | +## 4) Top-Level Command Surface Check |
| 42 | + |
| 43 | +These commands confirm every top-level command is registered and callable. |
| 44 | + |
| 45 | +```bash |
| 46 | +./codewise-cli config --help |
| 47 | +./codewise-cli deploy --help |
| 48 | +./codewise-cli docker --help |
| 49 | +./codewise-cli encode --help |
| 50 | +./codewise-cli env --help |
| 51 | +./codewise-cli helm --help |
| 52 | +./codewise-cli init --help |
| 53 | +./codewise-cli k8s --help |
| 54 | +./codewise-cli template --help |
| 55 | +``` |
| 56 | + |
| 57 | +## 5) Config Workflow |
| 58 | + |
| 59 | +This validates local configuration initialization and read-back. |
| 60 | + |
| 61 | +```bash |
| 62 | +./codewise-cli config init |
| 63 | +./codewise-cli config view |
| 64 | +cat ~/.codewise/config.yaml |
| 65 | +``` |
| 66 | + |
| 67 | +## 6) Encode/Convert Workflow (Fixture-Based) |
| 68 | + |
| 69 | +These commands validate common encode paths using files in `testdata/`. |
| 70 | + |
| 71 | +```bash |
| 72 | +./codewise-cli encode -i testdata/sample.yaml -o /tmp/cw_sample_1.json |
| 73 | +./codewise-cli encode -i testdata/sample.json -o /tmp/cw_sample_2.yaml --json-to-yaml |
| 74 | +./codewise-cli encode -i testdata/sample.env -o /tmp/cw_sample_3.json --env-to-json |
| 75 | +./codewise-cli encode -i testdata/sample.txt -o /tmp/cw_sample_4.b64 --base64 |
| 76 | +./codewise-cli encode -i /tmp/cw_sample_4.b64 -o /tmp/cw_sample_5.txt --base64 --decode |
| 77 | +``` |
| 78 | + |
| 79 | +Quick output validation for generated artifacts. |
| 80 | + |
| 81 | +```bash |
| 82 | +ls -lh /tmp/cw_sample_1.json /tmp/cw_sample_2.yaml /tmp/cw_sample_3.json /tmp/cw_sample_4.b64 /tmp/cw_sample_5.txt |
| 83 | +diff -u testdata/sample.txt /tmp/cw_sample_5.txt |
| 84 | +``` |
| 85 | + |
| 86 | +## 7) Scaffold Generation (Local Safe) |
| 87 | + |
| 88 | +Use this to validate project scaffold generation for Kubernetes and Helm. |
| 89 | + |
| 90 | +```bash |
| 91 | +rm -rf helm/chart k8s/app |
| 92 | +./codewise-cli helm init |
| 93 | +./codewise-cli k8s init |
| 94 | +find helm -maxdepth 4 -type f | sort |
| 95 | +find k8s -maxdepth 4 -type f | sort |
| 96 | +``` |
| 97 | + |
| 98 | +## 8) Template Commands |
| 99 | + |
| 100 | +These validate template generation commands. |
| 101 | + |
| 102 | +```bash |
| 103 | +./codewise-cli template github-action |
| 104 | +./codewise-cli template argo-app |
| 105 | +``` |
| 106 | + |
| 107 | +## 9) Docker Workflow (Requires Docker Daemon) |
| 108 | + |
| 109 | +Run these if Docker is available and running on your machine. |
| 110 | + |
| 111 | +```bash |
| 112 | +./codewise-cli docker init |
| 113 | +./codewise-cli docker validate |
| 114 | +./codewise-cli docker build |
| 115 | +docker images | grep -i codewise |
| 116 | +``` |
| 117 | + |
| 118 | +## 10) Kubernetes Workflow (Dry-Run First) |
| 119 | + |
| 120 | +Use dry-run for safe validation without applying to the cluster. |
| 121 | + |
| 122 | +```bash |
| 123 | +./codewise-cli k8s apply --dry-run |
| 124 | +./codewise-cli k8s delete --dry-run |
| 125 | +``` |
| 126 | + |
| 127 | +## 11) Kubernetes Real Apply (Only On Test Cluster) |
| 128 | + |
| 129 | +Run this section only when your kube context points to a non-production cluster. |
| 130 | + |
| 131 | +```bash |
| 132 | +kubectl config current-context |
| 133 | +./codewise-cli k8s apply --namespace dev |
| 134 | +./codewise-cli deploy status --namespace dev |
| 135 | +./codewise-cli deploy logs --namespace dev |
| 136 | +./codewise-cli deploy history --namespace dev |
| 137 | +./codewise-cli deploy rollback --namespace dev |
| 138 | +./codewise-cli k8s delete --namespace dev |
| 139 | +``` |
| 140 | + |
| 141 | +## 12) Environment Command Validation |
| 142 | + |
| 143 | +Use help checks and simple actions to validate env command behavior. |
| 144 | + |
| 145 | +```bash |
| 146 | +./codewise-cli env --help |
| 147 | +./codewise-cli env list |
| 148 | +./codewise-cli env create dev |
| 149 | +./codewise-cli env list |
| 150 | +./codewise-cli env delete dev |
| 151 | +./codewise-cli env list |
| 152 | +``` |
| 153 | + |
| 154 | +## 13) Negative Testing |
| 155 | + |
| 156 | +These commands validate error handling and message quality for invalid inputs. |
| 157 | + |
| 158 | +```bash |
| 159 | +./codewise-cli encode -i does-not-exist.yaml -o /tmp/out.json |
| 160 | +./codewise-cli k8s apply --context definitely-not-real --dry-run |
| 161 | +./codewise-cli deploy status --namespace does-not-exist |
| 162 | +``` |
| 163 | + |
| 164 | +## 14) One-Line Regression Pack |
| 165 | + |
| 166 | +Use this compact command for quick regression checks before pushing changes. |
| 167 | + |
| 168 | +```bash |
| 169 | +make build && go test ./... -v && ./codewise-cli encode -i testdata/sample.yaml -o /tmp/reg.json && ./codewise-cli helm init && ./codewise-cli k8s init && ./codewise-cli k8s apply --dry-run |
| 170 | +``` |
| 171 | + |
| 172 | +## Expected Success Signals |
| 173 | + |
| 174 | +- Build exits with code 0. |
| 175 | +- Test commands pass with code 0. |
| 176 | +- Encode commands generate output files and decode roundtrip matches input. |
| 177 | +- Helm and Kubernetes scaffold files are generated without runtime errors. |
| 178 | +- Dry-run commands do not mutate cluster resources and still validate command flow. |
0 commit comments