package com.github.K0zka.kerub.planner.steps.vstorage.create

import com.github.K0zka.kerub.model.Host
import com.github.K0zka.kerub.model.VirtualStorageDevice
import com.github.K0zka.kerub.planner.OperationalState
import com.github.K0zka.kerub.utils.toSize
import org.junit.Assert
import org.junit.Test

class CreateImageTest {

	val device = VirtualStorageDevice(
			size = "128 GB".toSize(),
			readOnly = false,
			name = "test"
	)

	val host = Host(
			address = "host-1.example.com",
			publicKey = "",
			dedicated = true
	)

	@Test
	fun take() {
		val state = CreateImage(device, host).take(OperationalState.fromLists(
				hosts = listOf(host),
				vStorage = listOf(device)
		))

		Assert.assertTrue(state.vStorageDyns.values.any {
			it.hostId == host.id
					&& it.id == device.id
		})
	}
}
Test for the CreateImage state transformation
Test for the CreateImage state transformation

Bug-Url: https://github.com/kerubistan/kerub/issues/23
Signed-off-by: Laszlo Hornyak <b67b79795179d8ff38e8fa896b513991ab7f1811@gmail.com>

kerubistan/kerub,K0zka/kerub,kerubistan/kerub,K0zka/kerub,K0zka/kerub,kerubistan/kerub