summaryrefslogtreecommitdiff
path: root/opendc-trace/opendc-trace-wfformat/src/test
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-06-09 10:31:41 +0200
committerGitHub <noreply@github.com>2022-06-09 10:31:41 +0200
commitd146814bbbb86bfcb19ccb94250424703e9179e5 (patch)
treebf20f51b434d56e60ad013568ac1a32b912a3b5e /opendc-trace/opendc-trace-wfformat/src/test
parent61b6550d7a476ab1aae45a5b9385dfd6ca4f6b6f (diff)
parent9d759c9bc987965fae8b0c16c000772c546bf3a2 (diff)
merge: Introduce schema for trace API (#88)
This pull request updates the OpenDC trace API to support proper specification of a schema of the tables exposed by the traces. This functionality makes it easier for the API consumer to understand the types exposed by the API. ## Implementation Notes :hammer_and_pick: * Introduce type system for trace API * Add benchmarks for odcvm trace format * Add benchmarks for Azure trace format * Add conformance suite for OpenDC trace API ## External Dependencies :four_leaf_clover: * N/A ## Breaking API Changes :warning: * Removal of typed `TableColumn`. Instead, `TableColumn` instances are now used to describe the columns belonging to some table. * `TableReader` and `TableWriter` do not support accessing arbitrary objects anymore. Instead, only the types supported by the type system are exposed.
Diffstat (limited to 'opendc-trace/opendc-trace-wfformat/src/test')
-rw-r--r--opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt6
-rw-r--r--opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt40
2 files changed, 32 insertions, 14 deletions
diff --git a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt
index e27bc82c..9d9735b1 100644
--- a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt
+++ b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTaskTableReaderTest.kt
@@ -210,7 +210,7 @@ internal class WfFormatTaskTableReaderTest {
val reader = WfFormatTaskTableReader(parser)
assertTrue(reader.nextRow())
- assertEquals("test", reader.get(TASK_ID))
+ assertEquals("test", reader.getString(TASK_ID))
assertFalse(reader.nextRow())
reader.close()
@@ -281,7 +281,7 @@ internal class WfFormatTaskTableReaderTest {
val reader = WfFormatTaskTableReader(parser)
assertTrue(reader.nextRow())
- assertEquals(setOf("1"), reader.get(TASK_PARENTS))
+ assertEquals(setOf("1"), reader.getSet(TASK_PARENTS, String::class.java))
assertFalse(reader.nextRow())
reader.close()
@@ -337,7 +337,7 @@ internal class WfFormatTaskTableReaderTest {
assertTrue(reader.nextRow())
assertTrue(reader.nextRow())
- assertEquals("test2", reader.get(TASK_ID))
+ assertEquals("test2", reader.getString(TASK_ID))
assertFalse(reader.nextRow())
reader.close()
diff --git a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt
index 4a8b2792..40506d59 100644
--- a/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt
+++ b/opendc-trace/opendc-trace-wfformat/src/test/kotlin/org/opendc/trace/wfformat/WfFormatTraceFormatTest.kt
@@ -22,17 +22,20 @@
package org.opendc.trace.wfformat
-import org.junit.jupiter.api.Assertions
+import org.junit.jupiter.api.*
import org.junit.jupiter.api.Assertions.*
-import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.Assertions.assertAll
import org.junit.jupiter.api.assertDoesNotThrow
-import org.junit.jupiter.api.assertThrows
+import org.opendc.trace.TableColumn
+import org.opendc.trace.TableReader
import org.opendc.trace.conv.*
+import org.opendc.trace.testkit.TableReaderTestKit
import java.nio.file.Paths
/**
* Test suite for the [WfFormatTraceFormat] class.
*/
+@DisplayName("WfFormat TraceFormat")
class WfFormatTraceFormatTest {
private val format = WfFormatTraceFormat()
@@ -66,18 +69,18 @@ class WfFormatTraceFormatTest {
assertAll(
{ assertTrue(reader.nextRow()) },
- { assertEquals("makebwaindex_mammoth_mt_krause.fasta", reader.get(TASK_ID)) },
- { assertEquals("eager-nextflow-chameleon", reader.get(TASK_WORKFLOW_ID)) },
- { assertEquals(172000, reader.get(TASK_RUNTIME).toMillis()) },
- { assertEquals(emptySet<String>(), reader.get(TASK_PARENTS)) },
+ { assertEquals("makebwaindex_mammoth_mt_krause.fasta", reader.getString(TASK_ID)) },
+ { assertEquals("eager-nextflow-chameleon", reader.getString(TASK_WORKFLOW_ID)) },
+ { assertEquals(172000, reader.getDuration(TASK_RUNTIME)?.toMillis()) },
+ { assertEquals(emptySet<String>(), reader.getSet(TASK_PARENTS, String::class.java)) },
)
assertAll(
{ assertTrue(reader.nextRow()) },
- { assertEquals("makeseqdict_mammoth_mt_krause.fasta", reader.get(TASK_ID)) },
- { assertEquals("eager-nextflow-chameleon", reader.get(TASK_WORKFLOW_ID)) },
- { assertEquals(175000, reader.get(TASK_RUNTIME).toMillis()) },
- { assertEquals(setOf("makebwaindex_mammoth_mt_krause.fasta"), reader.get(TASK_PARENTS)) },
+ { assertEquals("makeseqdict_mammoth_mt_krause.fasta", reader.getString(TASK_ID)) },
+ { assertEquals("eager-nextflow-chameleon", reader.getString(TASK_WORKFLOW_ID)) },
+ { assertEquals(175000, reader.getDuration(TASK_RUNTIME)?.toMillis()) },
+ { assertEquals(setOf("makebwaindex_mammoth_mt_krause.fasta"), reader.getSet(TASK_PARENTS, String::class.java)) },
)
reader.close()
@@ -98,4 +101,19 @@ class WfFormatTraceFormatTest {
reader.close()
}
}
+
+ @DisplayName("TableReader for Tasks")
+ @Nested
+ inner class TasksTableReaderTest : TableReaderTestKit() {
+ override lateinit var reader: TableReader
+ override lateinit var columns: List<TableColumn>
+
+ @BeforeEach
+ fun setUp() {
+ val path = Paths.get("src/test/resources/trace.json")
+
+ columns = format.getDetails(path, TABLE_TASKS).columns
+ reader = format.newReader(path, TABLE_TASKS, null)
+ }
+ }
}