use chrono::NaiveDate;
use release_tool::command::SystemCommandRunner;
use release_tool::config::Config;
use release_tool::domain::ReleaseIntent;
use release_tool::git::RepositorySnapshot;
use release_tool::lifecycle::resolve_plan;
use release_tool::tag::TagCatalog;
use std::sync::Arc;
#[test]
fn selected_targets_cannot_claim_the_same_remote_artifact_identity() {
let config = Config::parse(
r#"required_version = "0.1.0"
[repository]
github = "computed-parameter/example"
branch = "main"
[publishers.release]
kind = "github_release"
title = "Example {version}"
prerelease = true
[[targets]]
name = "one"
kind = "docker_archive"
publisher = "release"
default = true
platform = "linux/amd64"
image = "one:{version}"
asset = "shared-{version}.tar.xz"
build = ["just", "one"]
local_check = ["just", "check-one"]
[[targets]]
name = "two"
kind = "docker_archive"
publisher = "release"
default = true
platform = "linux/amd64"
image = "two:{version}"
asset = "shared-{version}.tar.xz"
build = ["just", "two"]
local_check = ["just", "check-two"]
"#,
)
.unwrap();
let snapshot = RepositorySnapshot {
root: ".".into(),
branch: "main".to_owned(),
head: "commit01".to_owned(),
remote_branch_head: "commit01".to_owned(),
tags: TagCatalog::default(),
};
let error = resolve_plan(
&config,
&snapshot,
ReleaseIntent::New,
NaiveDate::from_ymd_opt(2026, 8, 23).unwrap(),
&[],
false,
Arc::new(SystemCommandRunner),
)
.unwrap_err();
assert!(error.to_string().contains("same artifact identity"));
assert!(error.to_string().contains("one"));
assert!(error.to_string().contains("two"));
}