From 0fd7b3116fbace7deb8202d1849cece7146462a9 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 17 Jun 2021 14:15:45 +0200 Subject: faas: Rename opendc-serverless to opendc-faas This change renames the opendc-serverless module to opendc-faas to better distinguish between the two terms (Serverless and FaaS) and be clearer about the intent of the module. The opendc-faas module holds the code for the FaaS platform on top of OpenDC. Although this is one approach of doing serverless, serverless can also entail other services that will not be covered by this module. --- .../simulator/SimServerlessServiceTest.kt | 91 ---------------------- 1 file changed, 91 deletions(-) delete mode 100644 opendc-serverless/opendc-serverless-simulator/src/test/kotlin/org/opendc/serverless/simulator/SimServerlessServiceTest.kt (limited to 'opendc-serverless/opendc-serverless-simulator/src/test') diff --git a/opendc-serverless/opendc-serverless-simulator/src/test/kotlin/org/opendc/serverless/simulator/SimServerlessServiceTest.kt b/opendc-serverless/opendc-serverless-simulator/src/test/kotlin/org/opendc/serverless/simulator/SimServerlessServiceTest.kt deleted file mode 100644 index 6afa1b65..00000000 --- a/opendc-serverless/opendc-serverless-simulator/src/test/kotlin/org/opendc/serverless/simulator/SimServerlessServiceTest.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2021 AtLarge Research - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package org.opendc.serverless.simulator - -import io.mockk.coVerify -import io.mockk.spyk -import io.opentelemetry.api.metrics.MeterProvider -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.delay -import kotlinx.coroutines.yield -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertAll -import org.opendc.serverless.service.ServerlessService -import org.opendc.serverless.service.autoscaler.FunctionTerminationPolicyFixed -import org.opendc.serverless.service.router.RandomRoutingPolicy -import org.opendc.serverless.simulator.delay.ZeroDelayInjector -import org.opendc.serverless.simulator.workload.SimServerlessWorkload -import org.opendc.simulator.compute.SimMachineModel -import org.opendc.simulator.compute.model.MemoryUnit -import org.opendc.simulator.compute.model.ProcessingNode -import org.opendc.simulator.compute.model.ProcessingUnit -import org.opendc.simulator.compute.workload.SimFlopsWorkload -import org.opendc.simulator.compute.workload.SimWorkload -import org.opendc.simulator.core.runBlockingSimulation - -/** - * A test suite for the [ServerlessService] implementation under simulated conditions. - */ -@OptIn(ExperimentalCoroutinesApi::class) -internal class SimServerlessServiceTest { - - private lateinit var machineModel: SimMachineModel - - @BeforeEach - fun setUp() { - val cpuNode = ProcessingNode("Intel", "Xeon", "amd64", 2) - - machineModel = SimMachineModel( - cpus = List(cpuNode.coreCount) { ProcessingUnit(cpuNode, it, 1000.0) }, - memory = List(4) { MemoryUnit("Crucial", "MTA18ASF4G72AZ-3G2B1", 3200.0, 32_000) } - ) - } - - @Test - fun testSmoke() = runBlockingSimulation { - val meter = MeterProvider.noop().get("opendc-serverless") - val workload = spyk(object : SimServerlessWorkload, SimWorkload by SimFlopsWorkload(1000) { - override suspend fun invoke() {} - }) - val deployer = SimFunctionDeployer(clock, this, machineModel, ZeroDelayInjector) { workload } - val service = ServerlessService( - coroutineContext, clock, meter, deployer, RandomRoutingPolicy(), - FunctionTerminationPolicyFixed(coroutineContext, clock, timeout = 10000) - ) - - val client = service.newClient() - - val function = client.newFunction("test", 128) - function.invoke() - delay(2000) - - service.close() - - yield() - - assertAll( - { coVerify { workload.invoke() } }, - ) - } -} -- cgit v1.2.3