コード例 #1
0
func writeConfigFile(daemonConfig config.Daemon) string {
	configFile, err := ioutil.TempFile("", "test-config")
	Expect(err).NotTo(HaveOccurred())

	daemonConfig.Marshal(configFile)
	Expect(configFile.Close()).To(Succeed())

	return configFile.Name()
}
コード例 #2
0
					Password: "******",
					Name:     "some-database-name",
					SSLMode:  "some-ssl-mode",
				},
				Index:             9,
				HostAddress:       "10.244.16.3",
				ExternalDNSServer: "1.2.3.4",
				OverlayDNSAddress: "192.168.255.254",
				Suffix:            "potato",
				DebugAddress:      "0.0.0.0:19001",
			}

			configFile, err := ioutil.TempFile("", "config")
			Expect(err).NotTo(HaveOccurred())

			Expect(configSource.Marshal(configFile)).To(Succeed())
			configFile.Close()

			conf, err := config.ParseConfigFile(configFile.Name())
			Expect(err).NotTo(HaveOccurred())

			_, overlay, _ := net.ParseCIDR("192.168.0.0/16")

			expectedLocalSubnet := &net.IPNet{
				IP:   net.ParseIP("192.168.9.0"),
				Mask: net.CIDRMask(24, 32),
			}

			Expect(conf).To(Equal(&config.ValidatedConfig{
				ListenAddress:     "127.0.0.1:4001",
				OverlayNetwork:    overlay,