Skip to content

Instantly share code, notes, and snippets.

@aaron-prindle
Last active June 26, 2025 20:42
Show Gist options
  • Select an option

  • Save aaron-prindle/d831cfa6dce6a7d072f7449d76f433e9 to your computer and use it in GitHub Desktop.

Select an option

Save aaron-prindle/d831cfa6dce6a7d072f7449d76f433e9 to your computer and use it in GitHub Desktop.
parts := strings.Split(rsName, "-")
if len(parts) < 2 {
t.Errorf("ReplicaSet name should contain at least one hyphen separator")
}
hash := parts[len(parts)-1]
if len(hash) != 10 {
t.Errorf("Expected hash length of 10, got %d", len(hash))
}
deploymentPortion := strings.Join(parts[:len(parts)-1], "-")
if len(test.deploymentName) <= 242 {
if deploymentPortion != test.deploymentName {
t.Errorf("Deployment name portion mismatch: got %q, want %q", deploymentPortion, test.deploymentName)
}
} else {
if len(deploymentPortion) != 242 {
t.Errorf("Truncated deployment name should be 242 chars, got %d", len(deploymentPortion))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment