Exemple #1
0
func initializeNode(nodeName string, clusterName string) {
	if nodeName == "random_name" {
		nodeName = utils.GetRandomName(0)
	}
	counter := -2
	for nameExist(nodeName, clusterName) {
		nodeName = utils.GetRandomName(counter)
		counter++
	}
	log.Debugln("Node name: ", nodeName)
	node.CreateNode(nodeName, res.GetResources())
}
Exemple #2
0
func createMockPeers(nPeers int) map[string]string {
	mockPeers := make(map[string]string, nPeers)
	for i := 0; i < nPeers-1; i++ {
		name := utils.GetRandomName(0)
		mockPeers[name] = string(rand.Intn(nPeers))
	}
	return mockPeers
}