Ejemplo n.º 1
0
			Name:             "1.2.3.4:8888",
			GardenAddr:       "1.2.3.4:8888",
			ActiveContainers: 42,
			ResourceTypes: []atc.WorkerResourceType{
				{Type: "some-resource-b", Image: "some-image-b"},
			},
			Platform: "plan9",
			Tags:     []string{"russ", "cox", "was", "here"},
		}
		expectedSavedWorkerA := db.SavedWorker{
			WorkerInfo: infoA,
			ExpiresIn:  0,
		}

		By("persisting workers with no TTLs")
		savedWorkerA, err := database.SaveWorker(infoA, 0)
		Expect(err).NotTo(HaveOccurred())
		expectedSavedWorkerA.Name = savedWorkerA.Name

		Expect(database.Workers()).To(ConsistOf(expectedSavedWorkerA))

		By("being idempotent")
		_, err = database.SaveWorker(infoA, 0)
		Expect(err).NotTo(HaveOccurred())

		Expect(database.Workers()).To(ConsistOf(expectedSavedWorkerA))

		By("updating attributes by name")
		infoA.GardenAddr = "1.2.3.4:9876"
		expectedSavedWorkerA.WorkerInfo = infoA
Ejemplo n.º 2
0
				Tags:             []string{"vsphere"},
				Name:             "some-worker",
			}
			workerToInsert2 = db.WorkerInfo{
				GardenAddr:       "second-garden-address",
				BaggageclaimURL:  "some-baggageclaim-url",
				ActiveContainers: 0,
				ResourceTypes:    []atc.WorkerResourceType{},
				Platform:         "linux",
				Tags:             []string{"vsphere"},
				Name:             "second-worker",
			}
		})

		JustBeforeEach(func() {
			insertedWorker, err = database.SaveWorker(workerToInsert, 2*time.Minute)
			Expect(err).NotTo(HaveOccurred())

			insertedWorker2, err = database.SaveWorker(workerToInsert2, 2*time.Minute)
			Expect(err).NotTo(HaveOccurred())

			volumeToInsert.WorkerName = insertedWorker.Name
			err = database.InsertVolume(volumeToInsert)
			Expect(err).NotTo(HaveOccurred())
		})

		It("can be retrieved", func() {
			volumes, err := database.GetVolumes()
			Expect(err).NotTo(HaveOccurred())
			Expect(len(volumes)).To(Equal(1))
			actualVolume := volumes[0]