From 178541817d7cddb0207cf83f4518e2c5830d7d64 Mon Sep 17 00:00:00 2001 From: Markus Westerlind Date: Thu, 9 Jun 2022 19:08:37 +0200 Subject: [PATCH] refactor: Remove testing.loadMem (#4857) * refactor: Remove testing.loadMem I have not found anyone overriding this and I am not sure what such an override would do as `csv.from` already loads from memory. So I think we can just remove this entirely * chore: Don't use testing.loadMem in doc tests --- libflux/go/libflux/buildinfo.gen.go | 34 ++++++++-------- semantic/ast_test.go | 2 +- .../bonitoo-io/tickscript/alert_test.flux | 2 +- .../tickscript/alert_with_topic_test.flux | 2 +- .../tickscript/deadman_threshold_test.flux | 2 +- stdlib/experimental/oee/apq_test.flux | 2 +- stdlib/experimental/oee/computeapq_test.flux | 6 +-- stdlib/experimental/table/fill_test.flux | 7 ++-- stdlib/internal/debug/debug_test.flux | 4 +- stdlib/planner/group_max_test.flux | 12 +++--- stdlib/planner/group_min_max_table_test.flux | 6 +-- stdlib/planner/group_min_test.flux | 12 +++--- stdlib/testing/testing.flux | 39 +++---------------- stdlib/universe/join_test.flux | 2 +- stdlib/universe/limit_offset_test.flux | 2 +- stdlib/universe/limit_test.flux | 2 +- stdlib/universe/merge_filter_test.flux | 4 +- stdlib/universe/pivot_table_test.flux | 2 +- stdlib/universe/yield_test.flux | 2 +- 19 files changed, 58 insertions(+), 86 deletions(-) diff --git a/libflux/go/libflux/buildinfo.gen.go b/libflux/go/libflux/buildinfo.gen.go index 1739d267ed..8f69cd2e37 100644 --- a/libflux/go/libflux/buildinfo.gen.go +++ b/libflux/go/libflux/buildinfo.gen.go @@ -79,10 +79,10 @@ var sourceHashes = map[string]string{ "stdlib/contrib/bonitoo-io/alerta/alerta.flux": "729c6b1d714df1bf81d23e721bf3ce9176e6c18f78cf81fc25d7a6dad9b6ae79", "stdlib/contrib/bonitoo-io/hex/hex.flux": "85e6bb6a6937274291bcd3ff4bd9802baff1c61f6dd168c6441cfd4dcd70e608", "stdlib/contrib/bonitoo-io/servicenow/servicenow.flux": "708bfd4a1e3acd96d283f098c84ea43f84528333e946097a1169255856a56383", - "stdlib/contrib/bonitoo-io/tickscript/alert_test.flux": "ca86e290a8ee6926871fa74ab780248379632df07311f6868f688ced4e9df010", - "stdlib/contrib/bonitoo-io/tickscript/alert_with_topic_test.flux": "c008371243b2c2e158b11f9e22a843cc0a4b1b54875c33a5c3f8e1efbee802a0", + "stdlib/contrib/bonitoo-io/tickscript/alert_test.flux": "0b9e845b6752f3550caeb2fd0c647876fb7c9445d0761be523091038062e6a1a", + "stdlib/contrib/bonitoo-io/tickscript/alert_with_topic_test.flux": "33c1b33fd8a9920446fcdca8397e23ea04b819ccdedaf3bbca5e90b588cc0fa5", "stdlib/contrib/bonitoo-io/tickscript/deadman_empty_test.flux": "bc36cecbc82e76e142050ba23d07978949a32dd883a939af301fd1cd3673c236", - "stdlib/contrib/bonitoo-io/tickscript/deadman_threshold_test.flux": "9085e440478b52be0cf93182bf86dddcdecf772b2c052b255a17971518a7403e", + "stdlib/contrib/bonitoo-io/tickscript/deadman_threshold_test.flux": "a61dae8c981ba077c090e72671a89f6ebcbfc4c85251c6ede9be63f1890607a3", "stdlib/contrib/bonitoo-io/tickscript/tickscript.flux": "b42887c75b16ffe479b5f41f40ba9226fd41b8b9ebf7092d3b2772b0eccad17b", "stdlib/contrib/bonitoo-io/victorops/victorops.flux": "33e4fecfd18f10d87d64ec56561cf15c6a95c44e8c31e000dd0e85d8917348d6", "stdlib/contrib/bonitoo-io/zenoss/zenoss.flux": "00056d361ac546020968ecdfe20661333f388d8a68d7b79471239e02043dedbb", @@ -197,8 +197,8 @@ var sourceHashes = map[string]string{ "stdlib/experimental/mode_test.flux": "edf992c49b16765087ec0360aeeb1521bc72a1051bdd94525d7cb8c5cbf768d0", "stdlib/experimental/mqtt/mqtt.flux": "31aeae56a961429a0a69f930f2184a006b6f4269923d73dde98883fa5bec8805", "stdlib/experimental/mqtt/mqtt_test.flux": "bfb77c41bccffcf5890027ec49e29c9c607c7bb59459dabec772fb989031c5a9", - "stdlib/experimental/oee/apq_test.flux": "661cf1f05bdf25c030ecfefcaaa6924faeaf60ae825fb992a53968a72b8910e1", - "stdlib/experimental/oee/computeapq_test.flux": "aff67b04f9ed1e3f88d25dc0de86723a224965413473163855164d98818475fa", + "stdlib/experimental/oee/apq_test.flux": "468e6889dfb02ae4258c828d104620beadceffdef407f6f6f1ce2b2417c724d9", + "stdlib/experimental/oee/computeapq_test.flux": "8365fa1734e8bb1336a640dfb14721d9f17e570e555594bc2a31a4dabf2ddca4", "stdlib/experimental/oee/oee.flux": "30d6ce4144d1425cb9b294bd17fd73395d2a7c87b86c089aa89e73969a5b98f3", "stdlib/experimental/preview_test.flux": "cca570d25b17ed201a0ecc7ebf9e547ccff2aa0814a3ac49f12faa938cbdaf73", "stdlib/experimental/prometheus/prometheus.flux": "e0b3df509c8f522edee1081e5e3907ce9628f783d33b47c2e2d8ffb766f3f948", @@ -212,7 +212,7 @@ var sourceHashes = map[string]string{ "stdlib/experimental/spread_test.flux": "2651d6a5dd37bf8081c281e4e3e7f7fc8816334394a6e205b216041f3fb93b16", "stdlib/experimental/stddev_test.flux": "7599e6ac73721abbc5f4f54e2de926dc56fff0255cf880e9106bc4cdd0db7d71", "stdlib/experimental/sum_test.flux": "66504d439f767a16ad0b4d7d9a7e053d32269ff3663b96ca5a40369971771858", - "stdlib/experimental/table/fill_test.flux": "60813f53da61e0be3cc62bd24705de7ce66001269c583cda0e4d22edeb7671ce", + "stdlib/experimental/table/fill_test.flux": "7d853cc5bcd4a67873fb3221ae95fba1f175505207c20d62bb7394596489d8fb", "stdlib/experimental/table/table.flux": "ec101a99eb148c5112217c622395d5915fb055219cb4b814a1e18df602c25524", "stdlib/experimental/unique_test.flux": "78d1d389d21721155bd1ea27302664295cd9fdd1f29e3091a41dfdc43a299ec1", "stdlib/experimental/universe/universe.flux": "a4a9debf27ab2f7febd79541f3898de991f05591eaeb14162179cbe1df1121e1", @@ -256,7 +256,7 @@ var sourceHashes = map[string]string{ "stdlib/influxdata/influxdb/v1/v1.flux": "8fdebd101bdd025b105fda3c7fac0c496372cb7027aa4df499c4ae5fa24bacad", "stdlib/internal/boolean/boolean.flux": "1c0a1564911dd5f4c35c17efb32158ab31c51b20ac0f25175545e50aadc87c94", "stdlib/internal/debug/debug.flux": "104485f6a8d6e1cd2fc8111367687fed4cef2a63b5a7657124571b89b0e2420c", - "stdlib/internal/debug/debug_test.flux": "648141c9a2a3c0be363993e2c44af5b3d4d3a6f58b68dda2207adbdd6846d328", + "stdlib/internal/debug/debug_test.flux": "063349cd314ed79906a96d84ed3c6829c734d1607e0bbae0654bdc9e22210e3c", "stdlib/internal/gen/gen.flux": "320c005cffe97f28324a21054089cf78a2e6c511c639c4c0d1df727e46072c05", "stdlib/internal/influxql/influxql.flux": "51739e7d9026cae356fdef79a4340d2bda7fc10d1daa1a7adeae06014f85049c", "stdlib/internal/location/location.flux": "e810d8264dd1590f9556259cfa76272c8e5698a0262509d0ca12bfd4c71342f5", @@ -294,11 +294,11 @@ var sourceHashes = map[string]string{ "stdlib/planner/group_first_last_test.flux": "9d6fad804d35eb6ed9e78d067bf2a7a99dedb2045620ca9f1a3522a8d13ae097", "stdlib/planner/group_max_eval_test.flux": "4d9f220e34e5268d2e225661988f0905b72441787fa480efcde9f79a50d1581c", "stdlib/planner/group_max_push_test.flux": "8d8d541ba33f7b8fd4ac0964868dd8c72e9b240c7ef9d251af068d4dcde8f563", - "stdlib/planner/group_max_test.flux": "8e4389412f8ce34351c26ef6d111789d120ecd3c32a5ce7b1ad09383ca623b59", + "stdlib/planner/group_max_test.flux": "764b2de5f1636648947fd147dc90c45305e035b6c89ded573a474b1d2b1db010", "stdlib/planner/group_min_eval_test.flux": "960b83bb3746aae511b5b7b51b3ff88d2348bc717f440a98ba4f616588144c4c", - "stdlib/planner/group_min_max_table_test.flux": "03f5aa42651c7cecdf21146291a8d83bd1baf2b7c534e26ecf436b2bcc4e90f4", + "stdlib/planner/group_min_max_table_test.flux": "a4797fa039cc60661e8d68965636c9b9ffc24c16b9905008a816d928fcca5a15", "stdlib/planner/group_min_push_test.flux": "32878aa1dfc411a652511c8b77e4c1b586f260d4f3453393a756072fe7f70367", - "stdlib/planner/group_min_test.flux": "bcde68506afc2fc21a3d6ddddc5180f37de914a9052a59da09244b83595f24fd", + "stdlib/planner/group_min_test.flux": "27411c88c39d4367d65b53cb4327149e9cfeab24e4f53943c113172278a1e25e", "stdlib/planner/group_sum_eval_test.flux": "1123cfa595dbb3d8e7605bced637b1be6ac9a23980c52ff3fda4ce686a66d819", "stdlib/planner/group_sum_push_test.flux": "58acc5344bb261dba1c29a71730031a5ff13b37944562323ede814a31b46cd73", "stdlib/planner/planner.flux": "bb64ba6af236f78b7c62c5a478b2afebb6e196860a3e13417aa95126e3c4f5a5", @@ -400,7 +400,7 @@ var sourceHashes = map[string]string{ "stdlib/testing/promql/resets_test.flux": "e01bb24f576f8a2cb69fa1f5d9061cc852431970792ae2c59c3753580058926d", "stdlib/testing/promql/timestamp_test.flux": "350dc1161f222d2bfc327aee399ed9873e198c9858e845c2ca0b9ca0e2e38ef8", "stdlib/testing/promql/year_test.flux": "1767fb414d4261075880b0b9e5f6084cc1d9124fcb3759d68d3bea8a7c42977d", - "stdlib/testing/testing.flux": "a7d92ee395e5fc22841e75ba6e8218e6c1392f7235d014144f220f3af86e4a55", + "stdlib/testing/testing.flux": "e0b4cf8c03cdd4a8273db01be440cbf79b01d4261dc480fe870a769b19c4aff7", "stdlib/testing/testing_test.flux": "8b3a959c5987f2217e520d5c42d45a66a7361d23946978a751ea75f337b8eee8", "stdlib/testing/usage/api_test.flux": "2a39412eaf41ccb2436dbbdb250f9761544538252bbc6dd6d63b47d2d16e0136", "stdlib/testing/usage/duration_test.flux": "f545e7e8f1820bdae0beb935d12f899f1065b7b7df1c05eed454ecfb48fa4225", @@ -497,7 +497,7 @@ var sourceHashes = map[string]string{ "stdlib/universe/join_mismatched_schema_test.flux": "ec93ea26357783c15da7ac9be3b9b60d01122ad5fd482b802d5d9a6e7b3e5fb2", "stdlib/universe/join_missing_on_col_test.flux": "fb06c10442645d777ce3e3ad88da1caf573f23bf25e0cac6a719765c879fd5e2", "stdlib/universe/join_panic_test.flux": "952fbdf6e03b1ca36482a5a3b2fa9719e863f4c939dc1b3fc55460242a7a8f1a", - "stdlib/universe/join_test.flux": "6e2105c9f65104bbf6e813ba40877a8fd1bbe3e59b5172c43b4effdeee4c73f1", + "stdlib/universe/join_test.flux": "87961882808673aba3d84c5558a220192427c3c53b7121f89ce2ffbdce3b661c", "stdlib/universe/join_two_same_sources_test.flux": "e2c3347ab52bf85311532f6f06d1c23dfda1189372591c7156169b0c6acd60b5", "stdlib/universe/join_unsorted_columns_test.flux": "1e67d4c1aef04040f9ce31cc6a7394ed84c066d286c9ba4d93f5e0db78308632", "stdlib/universe/join_use_previous_test.flux": "8bd51934c1360fbda911dce18643ed20c6bd180017f400f8c777f5c562352dd4", @@ -512,8 +512,8 @@ var sourceHashes = map[string]string{ "stdlib/universe/key_values_test.flux": "2a6c38134dfac01f3df85871172f6611462d0880cd7d9b5fb3ecf2fc63a7efee", "stdlib/universe/keys_test.flux": "d386f3b542a275bd176c3ae2918ec3d5a6de52aa4a9de286743468a89a951ba1", "stdlib/universe/last_test.flux": "66684ffd24bc0488f7fe53f66badfe2201ba8cbff9cd88bb931630668fef7fe6", - "stdlib/universe/limit_offset_test.flux": "aa4fc7379badafd64700518af7e16c9326922055a7c9d5ebb8242168ccba5a57", - "stdlib/universe/limit_test.flux": "05680983d4ea937603bf9d5c71d69a49bfd5af71578299a5097becd73ed72dd9", + "stdlib/universe/limit_offset_test.flux": "897fecf073ff6e01ede481cfad23c2bfb114bce5e349621def84ffc793d54672", + "stdlib/universe/limit_test.flux": "38514fe1fc5f36d774216f6bb304671559842156ff2996b14a8adb1589f9e545", "stdlib/universe/lowestAverage_test.flux": "bc07318d63c62f8d1a171b028f897c01fc981c03915c01e647eaba6a79a0b852", "stdlib/universe/lowestCurrent_test.flux": "0110e5d56e9feb926cba8097d418b08fce0a70d194aeb0bf93254272d3f4136b", "stdlib/universe/lowestMin_test.flux": "823a9d836aaf31f1692eadffb46822ab12ac2d5051eafaf4ec4ffc67fb15d2d6", @@ -529,7 +529,7 @@ var sourceHashes = map[string]string{ "stdlib/universe/median_test.flux": "76b7d0ceb69c6c02a3c68c22757ace595d243be6d8badcf20661a8f66dc179c4", "stdlib/universe/merge_filter_flag_off_test.flux": "e3bbace624a29e2abd596f67148abd9ca8fc792705c98036310bd4a1b3c0ffe2", "stdlib/universe/merge_filter_flag_on_test.flux": "718f92af1959470ad1beaf7045fdbbff485e9f2ee395a0216795c3ec99744ff3", - "stdlib/universe/merge_filter_test.flux": "69aa3ec703228774f0ef4642bdc208d290a81ae0b6cc979234d146c19a05074b", + "stdlib/universe/merge_filter_test.flux": "b2b8f95eef0b90b039a779a1f01c69ef9aed2aa3f61e364e426901c505ed93c3", "stdlib/universe/meta_query_keys_test.flux": "bd8034a73e891ce9d857ade752a49d4f38a0b413f3c8d94e2f8c80452f900970", "stdlib/universe/min_test.flux": "e20a2ac20c2fca11f0f5bd0f2901df02952cef7ce2c6ba348bc9d0ed8493782f", "stdlib/universe/mode_string_test.flux": "657a8ce153411e70103460d8d8ecf18e3198450c0bc6eefa33bb1684fa025cd3", @@ -541,7 +541,7 @@ var sourceHashes = map[string]string{ "stdlib/universe/pivot_col_order_test.flux": "98c7fb481ba4eafca961a40220d5e1a3025a8b6982dc17be5f016c48f2124a2f", "stdlib/universe/pivot_fields_test.flux": "1a1517c9f7dd624600f3f3c1c9d01073ed24967975245833a18a20f0e506c0ad", "stdlib/universe/pivot_mean_test.flux": "14bdb7dd930de93217883c8f3082a857b8a1c3c101e224507e2ed0a7a21c8727", - "stdlib/universe/pivot_table_test.flux": "e2cddf128d66a031e4dc8307c8fb8098161f7d330049c0660232e9ecf638f9bc", + "stdlib/universe/pivot_table_test.flux": "c777217885549119e73215b4f85d82b11f1b751ce973ce001105541abc98e029", "stdlib/universe/pivot_task_test_test.flux": "e9fb8704a2000caeea0c7ef6e3b561290bac764a5d7bb490c3c3c4fc07bd475f", "stdlib/universe/pivot_test.flux": "e976a5124292d2d7d8e9022d085466deb0ad6639d422723bb1d00d698448e573", "stdlib/universe/quantile_agg_test.flux": "184c61f758aa9e1bc4ad42e07a1a43bcafe1061e821f2e644ae695da817375d4", @@ -606,5 +606,5 @@ var sourceHashes = map[string]string{ "stdlib/universe/window_null_test.flux": "3797d98035507192a911bd0e716a4f755f9555a46e96445331eb6033eeb837ca", "stdlib/universe/window_start_bound_test.flux": "8d6757e9d32021bd5655549a3601da97aeba74dcf6fe8a2854a70aca3637b7fa", "stdlib/universe/window_test.flux": "d2d32a8844c08ba920750b545ee0a491040caba58ea9a026379d935a01bf4ebc", - "stdlib/universe/yield_test.flux": "b7458fae0c3e97f21995bc9c1c2fa74025ea4b2c88e6f3b7d6d27f63d2f1460c", + "stdlib/universe/yield_test.flux": "d862e9ea52dbc09adb4995463235f3a51a41fcf7c95f472dac6bd792891de075", } diff --git a/semantic/ast_test.go b/semantic/ast_test.go index 79d3e235da..416ce5f3f8 100644 --- a/semantic/ast_test.go +++ b/semantic/ast_test.go @@ -103,7 +103,7 @@ my_value name: "option statement for subpackage", s: `import c "csv" import "testing" -option testing.loadMem = (csv) => c.from(csv: csv) +option testing.load = (tables) => tables `, }, { diff --git a/stdlib/contrib/bonitoo-io/tickscript/alert_test.flux b/stdlib/contrib/bonitoo-io/tickscript/alert_test.flux index c7307e16d0..6973e7f95e 100644 --- a/stdlib/contrib/bonitoo-io/tickscript/alert_test.flux +++ b/stdlib/contrib/bonitoo-io/tickscript/alert_test.flux @@ -69,7 +69,7 @@ tickscript_alert = (table=<-) => |> drop(columns: ["_time"]) testcase tickscript_alert { - want = testing.loadMem(csv: outData) + want = csv.from(csv: outData) got = csv.from(csv: inData) |> testing.load() |> tickscript_alert() testing.diff(want: want, got: got) |> yield() diff --git a/stdlib/contrib/bonitoo-io/tickscript/alert_with_topic_test.flux b/stdlib/contrib/bonitoo-io/tickscript/alert_with_topic_test.flux index 8412542a9e..00ff4d6ee9 100644 --- a/stdlib/contrib/bonitoo-io/tickscript/alert_with_topic_test.flux +++ b/stdlib/contrib/bonitoo-io/tickscript/alert_with_topic_test.flux @@ -70,7 +70,7 @@ tickscript_alert = (table=<-) => |> drop(columns: ["_time"]) testcase tickscript_alert_with_topic { - want = testing.loadMem(csv: outData) + want = csv.from(csv: outData) got = csv.from(csv: inData) |> testing.load() |> tickscript_alert() testing.diff(want: want, got: got) |> yield() diff --git a/stdlib/contrib/bonitoo-io/tickscript/deadman_threshold_test.flux b/stdlib/contrib/bonitoo-io/tickscript/deadman_threshold_test.flux index 4fd0606c45..a45444b640 100644 --- a/stdlib/contrib/bonitoo-io/tickscript/deadman_threshold_test.flux +++ b/stdlib/contrib/bonitoo-io/tickscript/deadman_threshold_test.flux @@ -60,7 +60,7 @@ tickscript_deadman = (table=<-) => |> drop(columns: ["_time"]) testcase tickscript_deadman_threshold { - want = testing.loadMem(csv: outData) + want = csv.from(csv: outData) got = csv.from(csv: inData) |> testing.load() |> tickscript_deadman() testing.diff(want: want, got: got) |> yield() diff --git a/stdlib/experimental/oee/apq_test.flux b/stdlib/experimental/oee/apq_test.flux index f2a144bfe9..c711b8227a 100644 --- a/stdlib/experimental/oee/apq_test.flux +++ b/stdlib/experimental/oee/apq_test.flux @@ -30,7 +30,7 @@ outData = testcase APQ { got = - testing.loadMem(csv: inData) + csv.from(csv: inData) |> range(start: 2021-03-22T00:00:00Z, stop: 2021-03-22T04:00:00Z) |> oee.APQ(runningState: "running", plannedTime: 8h, idealCycleTime: 30s) |> drop(columns: ["_start", "_stop"]) diff --git a/stdlib/experimental/oee/computeapq_test.flux b/stdlib/experimental/oee/computeapq_test.flux index 64464d3e04..c408f24d29 100644 --- a/stdlib/experimental/oee/computeapq_test.flux +++ b/stdlib/experimental/oee/computeapq_test.flux @@ -53,14 +53,14 @@ outData = ,,0,2021-03-22T04:00:00Z,0.375,0.24583333333333332,0.6666666666666666,0.9833333333333333,10800000000000 " productionEvents = - testing.loadMem(csv: productionData) + csv.from(csv: productionData) |> range(start: 2021-03-22T00:00:00Z, stop: 2021-03-22T04:00:00Z) partEvents = - testing.loadMem(csv: partData) + csv.from(csv: partData) |> range(start: 2021-03-22T00:00:00Z, stop: 2021-03-22T04:00:00Z) testcase computeAPQ { - table = testing.loadMem(csv: inData) + table = csv.from(csv: inData) got = oee.computeAPQ( productionEvents: productionEvents, diff --git a/stdlib/experimental/table/fill_test.flux b/stdlib/experimental/table/fill_test.flux index 7d4457c0a3..482ac2c9b5 100644 --- a/stdlib/experimental/table/fill_test.flux +++ b/stdlib/experimental/table/fill_test.flux @@ -2,6 +2,7 @@ package table_test import "array" +import "csv" import "planner" import "testing" import "testing/expect" @@ -104,7 +105,7 @@ loadData = () => testcase window { want = - testing.loadMem( + csv.from( csv: " #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,double,string @@ -237,7 +238,7 @@ test_idempotent = () => { want = - testing.loadMem( + csv.from( csv: " #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,double,string @@ -282,7 +283,7 @@ testcase idempotent_planner_rule { testcase fill_unknown_column { want = - testing.loadMem( + csv.from( csv: " #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,double,string diff --git a/stdlib/internal/debug/debug_test.flux b/stdlib/internal/debug/debug_test.flux index fa8db0ccd9..ae27c8cba9 100644 --- a/stdlib/internal/debug/debug_test.flux +++ b/stdlib/internal/debug/debug_test.flux @@ -38,13 +38,13 @@ input = () => testcase slurp { got = input() |> debug.slurp() - want = testing.loadMem(csv: inData) + want = csv.from(csv: inData) testing.diff(got, want) |> yield() } testcase sink { got = input() |> debug.sink() - want = testing.loadMem(csv: inData) |> filter(fn: (r) => false) + want = csv.from(csv: inData) |> filter(fn: (r) => false) testing.diff(got, want) |> yield() } diff --git a/stdlib/planner/group_max_test.flux b/stdlib/planner/group_max_test.flux index 4d0b18a4bf..9a1cbc3ee4 100644 --- a/stdlib/planner/group_max_test.flux +++ b/stdlib/planner/group_max_test.flux @@ -39,7 +39,7 @@ testcase group_max_bare { ,,0,2018-05-22T19:53:26Z,system,host.local,load4,1.77 " - testing.diff(got: result, want: testing.loadMem(csv: out_max_bare)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_max_bare)) |> yield() } input_host = @@ -79,7 +79,7 @@ testcase group_max_bare_host { ,,2,2018-05-22T19:53:36Z,system,host.local,load4,1.78 " - testing.diff(got: result, want: testing.loadMem(csv: out_max_bare)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_max_bare)) |> yield() } input_field = @@ -131,7 +131,7 @@ testcase group_max_bare_field { ,,2,2018-05-22T19:00:00Z,2018-05-24T00:00:00Z,hostC,load5,1.95 " - testing.diff(got: result, want: testing.loadMem(csv: out_max_bare)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_max_bare)) |> yield() } testcase group_max_window { result = @@ -151,7 +151,7 @@ testcase group_max_window { ,,0,2018-05-22T19:53:26Z,2018-05-23T00:00:00Z,2018-05-22T19:53:26Z,system,host.local,load4,1.77 " - testing.diff(got: result, want: testing.loadMem(csv: out_max_window)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_max_window)) |> yield() } testcase group_max_agg_window { result = @@ -169,7 +169,7 @@ testcase group_max_agg_window { ,,0,2018-05-22T19:53:26Z,2018-05-24T00:00:00Z,2018-05-23T00:00:00Z,system,host.local,load1,1.83 " - testing.diff(got: result, want: testing.loadMem(csv: out_max_agg_window)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_max_agg_window)) |> yield() } testcase group_max_agg_window_empty { result = @@ -193,5 +193,5 @@ testcase group_max_agg_window_empty { ,,2,2018-05-22T19:53:26Z,2018-05-24T00:00:00Z,2018-05-24T00:00:00Z,load4, " - testing.diff(got: result, want: testing.loadMem(csv: out_max_agg_window_empty)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_max_agg_window_empty)) |> yield() } diff --git a/stdlib/planner/group_min_max_table_test.flux b/stdlib/planner/group_min_max_table_test.flux index c5b7586e60..b3257dde35 100644 --- a/stdlib/planner/group_min_max_table_test.flux +++ b/stdlib/planner/group_min_max_table_test.flux @@ -109,7 +109,7 @@ testcase group_min_table { ,,2,2019-11-25T00:00:00Z,m0,f0,a-2,b-0,1.0 " - testing.diff(got: result, want: testing.loadMem(csv: out_min_table)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_min_table)) |> yield() } testcase group_max_table { result = @@ -130,7 +130,7 @@ testcase group_max_table { ,,2,2019-11-25T00:00:30Z,m0,f0,a-2,b-1,8.0 " - testing.diff(got: result, want: testing.loadMem(csv: out_max_table)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_max_table)) |> yield() } testcase group_no_agg_table { result = @@ -220,5 +220,5 @@ testcase group_no_agg_table { ,,2,2019-11-25T00:01:50Z,m0,f0,a-2,b-1,8.0 " - testing.diff(got: result, want: testing.loadMem(csv: out_no_agg_table)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_no_agg_table)) |> yield() } diff --git a/stdlib/planner/group_min_test.flux b/stdlib/planner/group_min_test.flux index 0a8f16917b..7f10d2277b 100644 --- a/stdlib/planner/group_min_test.flux +++ b/stdlib/planner/group_min_test.flux @@ -38,7 +38,7 @@ testcase group_min_bare { ,,0,2018-05-22T19:53:26Z,system,host.local,load4,1.77 " - testing.diff(got: result, want: testing.loadMem(csv: out_min_bare)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_min_bare)) |> yield() } input_host = @@ -78,7 +78,7 @@ testcase group_min_bare_host { ,,2,2018-05-22T19:53:26Z,system,host.local,load4,1.77 " - testing.diff(got: result, want: testing.loadMem(csv: out_min_bare)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_min_bare)) |> yield() } input_field = @@ -130,7 +130,7 @@ testcase group_min_bare_field { ,,2,2018-05-22T19:00:00Z,2018-05-24T00:00:00Z,hostC,load1,1.89 " - testing.diff(got: result, want: testing.loadMem(csv: out_min_bare)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_min_bare)) |> yield() } testcase group_min_window { result = @@ -150,7 +150,7 @@ testcase group_min_window { ,,0,2018-05-22T19:53:26Z,2018-05-23T00:00:00Z,2018-05-22T19:53:26Z,system,host.local,load4,1.77 " - testing.diff(got: result, want: testing.loadMem(csv: out_min_window)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_min_window)) |> yield() } testcase group_min_agg_window { result = @@ -168,7 +168,7 @@ testcase group_min_agg_window { ,,0,2018-05-22T19:53:26Z,2018-05-24T00:00:00Z,2018-05-23T00:00:00Z,system,host.local,load1,1.63 " - testing.diff(got: result, want: testing.loadMem(csv: out_min_agg_window)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_min_agg_window)) |> yield() } testcase group_min_agg_window_empty { result = @@ -192,5 +192,5 @@ testcase group_min_agg_window_empty { ,,2,2018-05-22T19:53:26Z,2018-05-24T00:00:00Z,2018-05-24T00:00:00Z,load4, " - testing.diff(got: result, want: testing.loadMem(csv: out_min_agg_window_empty)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_min_agg_window_empty)) |> yield() } diff --git a/stdlib/testing/testing.flux b/stdlib/testing/testing.flux index 7f1a745287..93d1ea021f 100644 --- a/stdlib/testing/testing.flux +++ b/stdlib/testing/testing.flux @@ -230,37 +230,6 @@ option loadStorage = (csv) => // option load = (tables=<-) => tables -// loadMem loads annotated CSV test data from memory to emulate query results -// returned by Flux. -// -// ## Parameters -// - csv: Annotated CSV data to load. -// -// ## Examples -// -// ### Load annotated CSV as if returned by Flux -// ``` -// import "testing" -// -// csvData = -// " -// #datatype,string,long,string,dateTime:RFC3339,string,double -// #group,false,false,true,false,true,false -// #default,_result,,,,, -// ,result,table,_measurement,_time,_field,_value -// ,,0,m,2021-01-01T00:00:00Z,t,1.2 -// ,,0,m,2021-01-02T00:00:00Z,t,1.4 -// ,,0,m,2021-01-03T00:00:00Z,t,2.2 -// " -// -// testing.loadMem(csv: csvData) -// ``` -// -// ## Metadata -// introduced: 0.20.0 -// -option loadMem = (csv) => c.from(csv: csv) - // inspect returns information about a test case. // // ## Parameters @@ -297,7 +266,7 @@ option loadMem = (csv) => c.from(csv: csv) // |> range(start: 2021-01-01T00:00:00Z, stop: 2021-01-03T01:00:00Z) // |> sum() // -// test _sum = () => ({input: testing.loadStorage(csv: inData), want: testing.loadMem(csv: outData), fn: t_sum}) +// test _sum = () => ({input: csv.from(csv: inData), want: csv.from(csv: outData), fn: t_sum}) // // testing.inpsect(case: _sum) // @@ -336,6 +305,7 @@ inspect = (case) => { // // ### Define and execute a test case // ``` +// import "csv" // import "testing" // // inData = @@ -363,7 +333,7 @@ inspect = (case) => { // |> range(start: 2021-01-01T00:00:00Z, stop: 2021-01-03T01:00:00Z) // |> sum() // -// test _sum = () => ({input: testing.loadStorage(csv: inData), want: testing.loadMem(csv: outData), fn: t_sum}) +// test _sum = () => ({input: csv.from(csv: inData), want: csv.from(csv: outData), fn: t_sum}) // // testing.run(case: _sum) // ``` @@ -389,6 +359,7 @@ run = (case) => { // profilers to measure query performance. // // ``` +// import "csv" // import "testing" // import "profiler" // @@ -419,7 +390,7 @@ run = (case) => { // |> range(start: 2021-01-01T00:00:00Z, stop: 2021-01-03T01:00:00Z) // |> sum() // -// test _sum = () => ({input: testing.loadStorage(csv: inData), want: testing.loadMem(csv: outData), fn: t_sum}) +// test _sum = () => ({input: csv.from(csv: inData), want: csv.from(csv: outData), fn: t_sum}) // // testing.benchmark(case: _sum) // ``` diff --git a/stdlib/universe/join_test.flux b/stdlib/universe/join_test.flux index 1f396dd1c2..d90a17a754 100644 --- a/stdlib/universe/join_test.flux +++ b/stdlib/universe/join_test.flux @@ -50,7 +50,7 @@ testcase join_base { |> testing.load() |> range(start: 2018-05-22T19:53:00Z, stop: 2018-05-22T19:55:00Z) |> drop(columns: ["_start", "_stop"]) - want = testing.loadMem(csv: outData) + want = csv.from(csv: outData) left = input |> filter(fn: (r) => r.user == "user1") diff --git a/stdlib/universe/limit_offset_test.flux b/stdlib/universe/limit_offset_test.flux index c46d0a2479..a74b33952c 100644 --- a/stdlib/universe/limit_offset_test.flux +++ b/stdlib/universe/limit_offset_test.flux @@ -61,7 +61,7 @@ input = () => testcase limit_offset { want = input() - got = testing.loadMem(csv: outData) + got = csv.from(csv: outData) testing.diff(want: want, got: got) |> yield() } diff --git a/stdlib/universe/limit_test.flux b/stdlib/universe/limit_test.flux index 1275b37c20..b07a57a4e4 100644 --- a/stdlib/universe/limit_test.flux +++ b/stdlib/universe/limit_test.flux @@ -57,7 +57,7 @@ input = () => testcase limit_1 { want = input() - got = testing.loadMem(csv: outData) + got = csv.from(csv: outData) testing.diff(want: want, got: got) |> yield() } diff --git a/stdlib/universe/merge_filter_test.flux b/stdlib/universe/merge_filter_test.flux index 48c854ae84..c816f106b5 100644 --- a/stdlib/universe/merge_filter_test.flux +++ b/stdlib/universe/merge_filter_test.flux @@ -41,7 +41,7 @@ merge_filter_fn = () => //testcase merge_filter { // expect.planner(rules: ["MergeFiltersRule": 1]) // result = merge_filter_fn() -// testing.diff(got: result, want: testing.loadMem(csv: output)) +// testing.diff(got: result, want: csv.from(csv: output)) //} testcase merge_filter_flag_off { option planner.disableLogicalRules = ["MergeFiltersRule"] @@ -50,5 +50,5 @@ testcase merge_filter_flag_off { result = merge_filter_fn() - testing.diff(got: result, want: testing.loadMem(csv: output)) + testing.diff(got: result, want: csv.from(csv: output)) } diff --git a/stdlib/universe/pivot_table_test.flux b/stdlib/universe/pivot_table_test.flux index e2ce1ee0ac..fc15db99de 100644 --- a/stdlib/universe/pivot_table_test.flux +++ b/stdlib/universe/pivot_table_test.flux @@ -79,5 +79,5 @@ testcase pivot_table { ,,1,2018-05-22T19:53:26Z,2030-01-01T00:00:00Z,2018-05-22T19:54:16Z,system,host.local,1.84,1.97,93 " - testing.diff(got: result, want: testing.loadMem(csv: out_fields)) |> yield() + testing.diff(got: result, want: csv.from(csv: out_fields)) |> yield() } diff --git a/stdlib/universe/yield_test.flux b/stdlib/universe/yield_test.flux index 0a04c1efab..90bfa782d3 100644 --- a/stdlib/universe/yield_test.flux +++ b/stdlib/universe/yield_test.flux @@ -46,7 +46,7 @@ testcase yield { |> sample(n: 2, pos: 1) |> yield(name: "2: 2nd row") |> yield(name: "5") - want = testing.loadMem(csv: outData) |> yield(name: "6") + want = csv.from(csv: outData) |> yield(name: "6") testing.diff(got, want) }