<commit_before>package integration_test

import (
	"time"

	. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
	. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"

	boshsettings "github.com/cloudfoundry/bosh-agent/settings"
)

var _ = Describe("RawEphemeralDisk", func() {
	var (
		registrySettings boshsettings.Settings
	)

	BeforeEach(func() {
		err := testEnvironment.StopAgent()
		Expect(err).ToNot(HaveOccurred())

		err = testEnvironment.CleanupDataDir()
		Expect(err).ToNot(HaveOccurred())

		err = testEnvironment.CleanupLogFile()
		Expect(err).ToNot(HaveOccurred())

		err = testEnvironment.SetupConfigDrive()
		Expect(err).ToNot(HaveOccurred())

		err = testEnvironment.UpdateAgentConfig("config-drive-agent.json")
		Expect(err).ToNot(HaveOccurred())

		networks, err := testEnvironment.GetVMNetworks()
		Expect(err).ToNot(HaveOccurred())

		registrySettings = boshsettings.Settings{
			AgentID: "fake-agent-id",
			Mbus:    "https://127.0.0.1:6868",
			Blobstore: boshsettings.Blobstore{
				Type: "local",
				Options: map[string]interface{}{
					"blobstore_path": "/var/vcap/data",
				},
			},
			Networks: networks,
		}
	})

	Context("when raw ephemeral disk is provided in settings", func() {
		BeforeEach(func() {
			err := testEnvironment.AttachDevice("/dev/sdh", 128, 2)
			Expect(err).ToNot(HaveOccurred())

			err = testEnvironment.AttachDevice("/dev/xvdb", 128, 1)
			Expect(err).ToNot(HaveOccurred())

			err = testEnvironment.AttachDevice("/dev/xvdc", 128, 1)
			Expect(err).ToNot(HaveOccurred())

			registrySettings.Disks = boshsettings.Disks{
				Ephemeral:         "/dev/sdh",
				RawEphemeral: []boshsettings.DiskSettings{{Path: "/dev/xvdb"}, {Path: "/dev/xvdc"}},
			}

			err = testEnvironment.StartRegistry(registrySettings)
			Expect(err).ToNot(HaveOccurred())

			err = testEnvironment.StartAgent()
			Expect(err).ToNot(HaveOccurred())
		})

		AfterEach(func() {
			err := testEnvironment.StopAgent()
			Expect(err).ToNot(HaveOccurred())

			err = testEnvironment.DetachDevice("/dev/sdh")
			Expect(err).ToNot(HaveOccurred())

			err = testEnvironment.DetachDevice("/dev/xvdb")
			Expect(err).ToNot(HaveOccurred())

			err = testEnvironment.DetachDevice("/dev/xvdc")
			Expect(err).ToNot(HaveOccurred())
		})

		It("labels the raw ephemeral paths for unpartitioned disks", func() {
			var output string

			Eventually(func() string {
				stdout, _ := testEnvironment.RunCommand("find /dev/disk/by-partlabel | sort")

				output = stdout

				return stdout
			}, 2*time.Minute, 1*time.Second).Should(ContainSubstring(`/dev/disk/by-partlabel/raw-ephemeral-0
/dev/disk/by-partlabel/raw-ephemeral-1`))
		})
	})

})<commit_msg>Revert "Fixes integration tests by waiting for both devices to show up"<commit_after>package integration_test

import (
	"time"
	"fmt"

	. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
	. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"

	boshsettings "github.com/cloudfoundry/bosh-agent/settings"
)

var _ = Describe("RawEphemeralDisk", func() {
	var (
		registrySettings boshsettings.Settings
	)

	BeforeEach(func() {
		err := testEnvironment.StopAgent()
		Expect(err).ToNot(HaveOccurred())

		err = testEnvironment.CleanupDataDir()
		Expect(err).ToNot(HaveOccurred())

		err = testEnvironment.CleanupLogFile()
		Expect(err).ToNot(HaveOccurred())

		err = testEnvironment.SetupConfigDrive()
		Expect(err).ToNot(HaveOccurred())

		err = testEnvironment.UpdateAgentConfig("config-drive-agent.json")
		Expect(err).ToNot(HaveOccurred())

		networks, err := testEnvironment.GetVMNetworks()
		Expect(err).ToNot(HaveOccurred())

		registrySettings = boshsettings.Settings{
			AgentID: "fake-agent-id",
			Mbus:    "https://127.0.0.1:6868",
			Blobstore: boshsettings.Blobstore{
				Type: "local",
				Options: map[string]interface{}{
					"blobstore_path": "/var/vcap/data",
				},
			},
			Networks: networks,
		}
	})

	Context("when raw ephemeral disk is provided in settings", func() {
		BeforeEach(func() {
			err := testEnvironment.AttachDevice("/dev/sdh", 128, 2)
			Expect(err).ToNot(HaveOccurred())

			fmt.Println("======== attaching devices xvdb")
			err = testEnvironment.AttachDevice("/dev/xvdb", 128, 1)
			Expect(err).ToNot(HaveOccurred())

			fmt.Println("======== attaching devices xvdc ")
			err = testEnvironment.AttachDevice("/dev/xvdc", 128, 1)
			Expect(err).ToNot(HaveOccurred())

			registrySettings.Disks = boshsettings.Disks{
				Ephemeral:         "/dev/sdh",
				RawEphemeral: []boshsettings.DiskSettings{{Path: "/dev/xvdb"}, {Path: "/dev/xvdc"}},
			}

			err = testEnvironment.StartRegistry(registrySettings)
			Expect(err).ToNot(HaveOccurred())

			fmt.Println("======== start agent")
			err = testEnvironment.StartAgent()
			Expect(err).ToNot(HaveOccurred())
		})

		AfterEach(func() {
			err := testEnvironment.StopAgent()
			Expect(err).ToNot(HaveOccurred())

			err = testEnvironment.DetachDevice("/dev/sdh")
			Expect(err).ToNot(HaveOccurred())

			fmt.Println("======== ======== detach devices xvdb")
			err = testEnvironment.DetachDevice("/dev/xvdb")
			Expect(err).ToNot(HaveOccurred())

			fmt.Println("======== detach devices xvdc")
			err = testEnvironment.DetachDevice("/dev/xvdc")
			Expect(err).ToNot(HaveOccurred())
		})

		It("labels the raw ephemeral paths for unpartitioned disks", func() {
			var output string

			Eventually(func() string {
				stdout, _ := testEnvironment.RunCommand("find /dev/disk/by-partlabel")

				output = stdout

//				Expect(err).ToNot(HaveOccurred())

				return stdout
			}, 2*time.Minute, 1*time.Second).Should(ContainSubstring("/dev/disk/by-partlabel/raw-ephemeral-0"))

			Expect(output).To(ContainSubstring("/dev/disk/by-partlabel/raw-ephemeral-1"))
		})
	})

})
{'fraction_non_alphanumeric': 0.16196573801695796, 'fraction_numerical': 0.008998096556497664, 'mean_word_length': 4.437441204139229, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4137359', 'n_tokens_mistral': 2310, 'n_tokens_neox': 1948, 'n_words': 287}