From cfd726fafe3b90b983468d44e2d6e331e92b4a43 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:16:04 +0000 Subject: [PATCH] Add testscript test for YAML corruption regression Co-authored-by: imjasonh <210737+imjasonh@users.noreply.github.com> --- tests/testdata/resolve_no_corruption.txt | 78 ++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 tests/testdata/resolve_no_corruption.txt diff --git a/tests/testdata/resolve_no_corruption.txt b/tests/testdata/resolve_no_corruption.txt new file mode 100644 index 0000000..8e48a5f --- /dev/null +++ b/tests/testdata/resolve_no_corruption.txt @@ -0,0 +1,78 @@ +# Test that multi-document YAML does not get corrupted with --- appended to values +# Regression test for issue #59 where values like "blah" became "blah---" + +-- Cargo.toml -- +[package] +name = "test-app" +version = "0.1.0" +edition = "2021" + +[dependencies] + +-- src/main.rs -- +fn main() { + println!("Hello from test-app!"); +} + +-- deployment.yaml -- +apiVersion: v1 +kind: Namespace +metadata: + name: blah + labels: + app: blah +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: blah-config + namespace: blah +data: + RUST_LOG: "info" + OTHER_VAR: "value" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: blah + namespace: blah + labels: + app: blah +spec: + replicas: 1 + selector: + matchLabels: + app: blah + template: + metadata: + labels: + app: blah + spec: + containers: + - name: blah + image: krust://. + imagePullPolicy: IfNotPresent + +# Resolve should not corrupt values by appending --- +env KRUST_REPO=ttl.sh/test +exec ./krust resolve -f deployment.yaml + +# Check that values are NOT corrupted with --- appended +! stdout 'blah---' +! stdout 'info---' +! stdout 'value---' + +# Check that proper values are present +stdout 'name: blah' +stdout 'namespace: blah' +stdout 'RUST_LOG: info' +stdout 'OTHER_VAR: value' + +# Check that documents are properly separated +stdout '---' + +# Check that the image was resolved +stdout 'ttl.sh/test/test-app@sha256:' +! stdout 'krust://' + +stderr 'Found 1 unique krust:// reference'