Skip to content

Commit

Permalink
Adds test to verify that bad YAML indentation does not cause a panic.
Browse files Browse the repository at this point in the history
  • Loading branch information
manadart committed Nov 21, 2023
1 parent 6e85fbe commit dfe343e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cloud/clouds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,19 @@ clouds:
s.assertCompareClouds(c, metadata, false)
}

func (s *cloudSuite) TestMalformedYAMLNoPanic(_ *gc.C) {
// Note the bad indentation. This case was reported under LP:2039322.
metadata := `
clouds:
manual-cloud:
type: manual
endpoint: ubuntu@some-host-fqdn
`[1:]

// We don't care about the result, just that there is no panic.
_, _ = cloud.ParseCloudMetadata([]byte(metadata))
}

func (s *cloudSuite) TestRegionNames(c *gc.C) {
regions := []cloud.Region{
{Name: "mars"},
Expand Down

0 comments on commit dfe343e

Please sign in to comment.