コード例 #1
0
				"192.168.0.157-192.168.0.203",
			},
		)
		ipPoolProvider.RegisterIpPool(ipPool)
		ipPoolProvider.RegisterIpPool(ipPool)

		ipPoolProvider.RegisterIpPool(ipPool)
		ipPoolProvider.RegisterIpPool(ipPool)

		expectedIpPool = ipPool
		// reserving 2 ips since we have 2 instances
		expectedIpPool.NextStaticIp()
		expectedIpPool.NextStaticIp()

		decider = &fakebftdecider.FakeDecider{}
		decider.IsYesYes = true
		logger := boshlog.NewLogger(boshlog.LevelNone)
		networksAssigner = NewAssigner(networks, nameGenerator, ipPoolProvider, decider, logger)
	})

	It("assigns network of the given type to job and cloud config", func() {
		input := bftinput.Input{
			Jobs: []bftinput.Job{
				{
					Name:              "foo",
					Instances:         2,
					AvailabilityZones: []string{"z1"},
				},
			},
			CloudConfig: bftinput.CloudConfig{
				AvailabilityZones: []bftinput.AvailabilityZone{
コード例 #2
0
		fakeDecider       *fakebftdecider.FakeDecider
		logger            boshlog.Logger
		vmType            Parameter
	)

	BeforeEach(func() {
		fakeNameGenerator = &fakebftnamegen.FakeNameGenerator{
			Names: []string{"fake-vm-type"},
		}
		fakeDecider = &fakebftdecider.FakeDecider{}
		logger = boshlog.NewLogger(boshlog.LevelNone)
	})

	Context("when definition is vm_type", func() {
		BeforeEach(func() {
			fakeDecider.IsYesYes = false
			vmType = NewVmType("vm_type", fakeNameGenerator, fakeDecider, logger)
		})

		It("adds vm_types to the input", func() {
			input := bftinput.Input{
				Jobs: []bftinput.Job{
					{
						Name: "fake-job",
					},
				},
			}

			result := vmType.Apply(input, bftinput.Input{})

			Expect(result).To(Equal(bftinput.Input{