예제 #1
0
파일: internal_test.go 프로젝트: bac/juju
func (s *cloudImageMetadataSuite) TestCloudImageMetadataDocFields(c *gc.C) {
	ignored := set.NewStrings("Id")
	migrated := set.NewStrings(
		"Stream",
		"Region",
		"Version",
		"Series",
		"Arch",
		"VirtType",
		"RootStorageType",
		"RootStorageSize",
		"Source",
		"Priority",
		"ImageId",
		"DateCreated",
	)
	fields := migrated.Union(ignored)
	expected := testing.GetExportedFields(imagesMetadataDoc{})
	unknown := expected.Difference(fields)
	removed := fields.Difference(expected)
	// If this test fails, it means that extra fields have been added to the
	// doc without thinking about the migration implications.
	c.Check(unknown, gc.HasLen, 0)
	c.Assert(removed, gc.HasLen, 0)
}
예제 #2
0
func (s *MigrationSuite) AssertExportedFields(c *gc.C, doc interface{}, fields set.Strings) {
	expected := testing.GetExportedFields(doc)
	unknown := expected.Difference(fields)
	removed := fields.Difference(expected)
	// If this test fails, it means that extra fields have been added to the
	// doc without thinking about the migration implications.
	c.Check(unknown, gc.HasLen, 0)
	c.Assert(removed, gc.HasLen, 0)
}