Skip to content

Commit

Permalink
Use validated hostname in instance_launch test
Browse files Browse the repository at this point in the history
  • Loading branch information
bnaecker committed Jan 31, 2024
1 parent 5c6e8ce commit 0b2a761
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions common/src/api/external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ impl Hostname {
//
// Note that we need to use a regex engine capable of lookbehind to support
// this, since we need to check that labels don't end with a `-`.
const HOSTNAME_REGEX: &str = r#"^([a-zA-Z0-9]+[a-zA-Z0-9\-]*(?<!-))(\.[a-zA-Z1-9]+[a-zA-Z0-9\-]*(?<!-))*$"#;
const HOSTNAME_REGEX: &str = r#"^([a-zA-Z0-9]+[a-zA-Z0-9\-]*(?<!-))(\.[a-zA-Z0-9]+[a-zA-Z0-9\-]*(?<!-))*$"#;

// Labels need to be encoded on the wire, and prefixed with a signel length
// octet. They also need to end with a length octet of 0 when encoded. So the
Expand Down Expand Up @@ -773,7 +773,7 @@ impl JsonSchema for Hostname {
"A hostname identifies a host on a network, and \
is usually a dot-delimited sequence of labels, \
where each label contains only letters, digits, \
or the hyphen. See RFCs 1035 an 952 for more details."
or the hyphen. See RFCs 1035 and 952 for more details."
.to_string(),
),
..Default::default()
Expand Down
2 changes: 1 addition & 1 deletion end-to-end-tests/src/instance_launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async fn instance_launch() -> Result<()> {
.body(InstanceCreate {
name: generate_name("instance")?,
description: String::new(),
hostname: "localshark".into(), // 🦈
hostname: "localshark".parse().unwrap(), // 🦈
memory: ByteCount(1024 * 1024 * 1024),
ncpus: InstanceCpuCount(2),
disks: vec![InstanceDiskAttachment::Attach {
Expand Down

0 comments on commit 0b2a761

Please sign in to comment.