當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Input.FindDiskTypeByName方法代碼示例

本文整理匯總了Golang中github.com/cloudfoundry-incubator/bosh-fuzz-tests/input.Input.FindDiskTypeByName方法的典型用法代碼示例。如果您正苦於以下問題:Golang Input.FindDiskTypeByName方法的具體用法?Golang Input.FindDiskTypeByName怎麽用?Golang Input.FindDiskTypeByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloudfoundry-incubator/bosh-fuzz-tests/input.Input的用法示例。


在下文中一共展示了Input.FindDiskTypeByName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: nothingChanged

func (n *nothingChangedComparator) nothingChanged(job bftinput.Job, currentInput bftinput.Input, previousInputs []bftinput.Input) bool {
	mostRecentInput := previousInputs[len(previousInputs)-1]

	prevJob, found := mostRecentInput.FindJobByName(job.Name)
	if !found {
		return false
	}

	if len(previousInputs) > 1 {
		inputBeforePrevious := previousInputs[len(previousInputs)-2]
		jobBeforePrevious, found := inputBeforePrevious.FindJobByName(job.Name)
		if found && jobBeforePrevious.HasPersistentDisk() && !prevJob.HasPersistentDisk() {
			return false
		}

		for _, migratedFromConfig := range prevJob.MigratedFrom {
			jobBeforePrevious, found := inputBeforePrevious.FindJobByName(migratedFromConfig.Name)
			if found && jobBeforePrevious.HasPersistentDisk() && !prevJob.HasPersistentDisk() {
				return false
			}
		}
	}

	if !prevJob.IsEqual(job) {
		return false
	}

	for _, azName := range job.AvailabilityZones {
		currentAz, _ := currentInput.FindAzByName(azName)
		prevAz, _ := mostRecentInput.FindAzByName(azName)
		if !currentAz.IsEqual(prevAz) {
			return false
		}
	}

	if job.PersistentDiskPool != "" {
		currentPersistentDiskPool, _ := currentInput.FindDiskPoolByName(job.PersistentDiskPool)
		prevPersistentDiskPool, _ := mostRecentInput.FindDiskPoolByName(job.PersistentDiskPool)
		if !currentPersistentDiskPool.IsEqual(prevPersistentDiskPool) {
			return false
		}
	}

	if job.PersistentDiskType != "" {
		currentPersistentDiskType, _ := currentInput.FindDiskTypeByName(job.PersistentDiskType)
		prevPersistentDiskType, _ := mostRecentInput.FindDiskTypeByName(job.PersistentDiskType)
		if !currentPersistentDiskType.IsEqual(prevPersistentDiskType) {
			return false
		}
	}

	if job.ResourcePool != "" {
		currentResourcePool, _ := currentInput.FindResourcePoolByName(job.ResourcePool)
		prevResourcePool, _ := mostRecentInput.FindResourcePoolByName(job.ResourcePool)
		if !currentResourcePool.IsEqual(prevResourcePool) {
			return false
		}
	}

	if job.VmType != "" {
		currentVmType, _ := currentInput.FindVmTypeByName(job.VmType)
		prevVmType, _ := mostRecentInput.FindVmTypeByName(job.VmType)
		if !currentVmType.IsEqual(prevVmType) {
			return false
		}
	}

	if job.Stemcell != "" {
		currentStemcell, _ := currentInput.FindStemcellByName(job.Stemcell)
		prevStemcell, _ := mostRecentInput.FindStemcellByName(job.Stemcell)
		if !currentStemcell.IsEqual(prevStemcell) {
			return false
		}
	}

	for _, jobNetwork := range job.Networks {
		currentNetwork, _ := currentInput.FindNetworkByName(jobNetwork.Name)
		prevNetwork, _ := mostRecentInput.FindNetworkByName(jobNetwork.Name)
		if !currentNetwork.IsEqual(prevNetwork) {
			return false
		}
	}

	return true
}
開發者ID:cloudfoundry-incubator,項目名稱:bosh-fuzz-tests,代碼行數:85,代碼來源:nothing_changed_comparator.go


注:本文中的github.com/cloudfoundry-incubator/bosh-fuzz-tests/input.Input.FindDiskTypeByName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。