Expect(serializedBytes).To(MatchJSON(fixtureJSON))
		})

		Context("when the input is not valid JSON", func() {
			It("returns an error", func() {
				configReader := strings.NewReader(`{{{{{`)
				_, err := config.Unmarshal(configReader)
				Expect(err).To(MatchError("json decode: invalid character '{' looking for beginning of object key string"))
			})
		})
	})

	Describe("parsing and validating the fields", func() {
		It("parses and composes the config into Go types", func() {
			validated, err := fixtureDaemon.ParseAndValidate()
			Expect(err).NotTo(HaveOccurred())

			_, expectedOverlay, _ := net.ParseCIDR("192.168.0.0/16")
			expectedLocalSubnet := &net.IPNet{
				IP:   net.ParseIP("192.168.9.0"),
				Mask: net.CIDRMask(16, 32),
			}

			dbURL := "postgres://*****:*****@10.244.16.9:5432/ducati?sslmode=disable"

			Expect(validated).To(Equal(&config.ValidatedConfig{
				ListenAddress:     "0.0.0.0:4001",
				OverlayNetwork:    expectedOverlay,
				LocalSubnet:       expectedLocalSubnet,
				DatabaseURL:       dbURL,