parts := strings.Split(rsName, "-") if len(parts) < 2 { t.Errorf("ReplicaSet name should contain at least one hyphen separator") } 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)) } }