func TestCATS(t *testing.T) {
	RegisterFailHandler(Fail)

	var validationError error
	Config, validationError = config.NewCatsConfig(os.Getenv("CONFIG"))

	var _ = BeforeSuite(func() {
		if validationError != nil {
			fmt.Println("Invalid configuration.  ")
			fmt.Println(validationError)
			Fail("Please fix the contents of $CONFIG:\n  " + os.Getenv("CONFIG") + "\nbefore proceeding.")
		}

		TestSetup = workflowhelpers.NewTestSuiteSetup(Config)

		installedVersion, err := GetInstalledCliVersionString()
		Expect(err).ToNot(HaveOccurred(), "Error trying to determine CF CLI version")

		Expect(ParseRawCliVersionString(installedVersion).AtLeast(ParseRawCliVersionString(minCliVersion))).To(BeTrue(), "CLI version "+minCliVersion+" is required")
		if Config.GetIncludeSsh() {
			ScpPath, err = exec.LookPath("scp")
			Expect(err).NotTo(HaveOccurred())

			SftpPath, err = exec.LookPath("sftp")
			Expect(err).NotTo(HaveOccurred())
		}
		TestSetup.Setup()
	})

	AfterSuite(func() {
		if TestSetup != nil {
			TestSetup.Teardown()
		}
	})

	rs := []Reporter{}

	if validationError == nil {
		if Config.GetArtifactsDirectory() != "" {
			helpers.EnableCFTrace(Config, "CATS")
			rs = append(rs, helpers.NewJUnitReporter(Config, "CATS"))
		}
	}

	RunSpecsWithDefaultAndCustomReporters(t, "CATS", rs)
}
예제 #2
0
	AfterEach(func() {
		err := os.Remove(tmpFilePath)
		Expect(err).NotTo(HaveOccurred())
	})

	It("should have the right defaults", func() {
		requiredCfg := requiredConfig{}
		requiredCfg.ApiEndpoint = testCfg.ApiEndpoint
		requiredCfg.AdminUser = testCfg.AdminUser
		requiredCfg.AdminPassword = testCfg.AdminPassword
		requiredCfg.SkipSSLValidation = testCfg.SkipSSLValidation
		requiredCfg.AppsDomain = testCfg.AppsDomain
		requiredCfg.UseHttp = ptrToBool(true)

		requiredCfgFilePath := writeConfigFile(requiredCfg)
		config, err := cfg.NewCatsConfig(requiredCfgFilePath)
		Expect(err).ToNot(HaveOccurred())
		Expect(config.GetIncludeApps()).To(BeTrue())
		Expect(config.GetPersistentAppHost()).To(Equal("CATS-persistent-app"))

		Expect(config.GetPersistentAppOrg()).To(Equal("CATS-persistent-org"))
		Expect(config.GetPersistentAppQuotaName()).To(Equal("CATS-persistent-quota"))
		Expect(config.GetPersistentAppSpace()).To(Equal("CATS-persistent-space"))

		Expect(config.GetIncludeApps()).To(BeTrue())
		Expect(config.GetIncludeDetect()).To(BeTrue())
		Expect(config.GetIncludeRouting()).To(BeTrue())

		Expect(config.GetIncludeBackendCompatiblity()).To(BeFalse())
		Expect(config.GetIncludeDocker()).To(BeFalse())
		Expect(config.GetIncludeInternetDependent()).To(BeFalse())