1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-07 22:35:25 +00:00

Add testscript test for YAML corruption regression

Co-authored-by: imjasonh <210737+imjasonh@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-10-17 14:16:04 +00:00
parent 2edb1e7d36
commit cfd726fafe

View file

@ -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'