Skip to content

Commit

Permalink
Merge branch 'branches/rudder/8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
amousset committed Oct 11, 2023
2 parents f426541 + 5ee0a27 commit dffc142
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions policies/rudderc/src/backends/unix/prelude.cf
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ bundle agent rudder_test_init {
"tmp" string => getenv("TMP_DIR","2048");
# Read params for current test case
"test_case" data => readyaml("${cwd}/${params}", 100k);
# Define conditions
"conditions" slist => getvalues("test_case[conditions]");

classes:
"${conditions}" expression => "any",
scope => "namespace";

methods:
# lib ("ncf") init, including modules update
Expand Down
9 changes: 8 additions & 1 deletion policies/rudderc/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
// Test file specifications. Do we want several test cases in one file?

use std::{collections::HashMap, path::Path, process::Command};
use std::{
collections::{HashMap, HashSet},
path::Path,
process::Command,
};

use anyhow::{bail, Result};
use rudder_commons::logs::ok_output;
Expand All @@ -30,6 +34,9 @@ pub struct TestCase {
#[serde(rename = "params")]
#[serde(default)]
parameters: HashMap<String, String>,
/// Conditions to define before running the test
#[serde(default)]
conditions: HashSet<String>,
/// Test setup steps
#[serde(default)]
setup: Vec<Step>,
Expand Down
1 change: 1 addition & 0 deletions policies/rudderc/tests/cases/test/one_param/technique.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ items:
- name: "Ensure correct ntp configuration"
id: d86ce2e5-d5b6-45cc-87e8-c11cca71d907
method: file_content
condition: my_cond
params:
path: "/tmp/rudderc_test_one"
lines: "${server}"
Expand Down
3 changes: 3 additions & 0 deletions policies/rudderc/tests/cases/test/one_param/tests/case1.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Parameters for the technique
params:
server: "rudder.io"
# Conditions to define before running the test
conditions:
- my_cond
# Prepare env
setup:
- sh: "rm -f /tmp/rudderc_test_one"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
bundle agent initialization {}
bundle agent rudder_reporting_context_v4(a, b, c, d, e, f) {}
bundle agent _method_reporting_context_v4(d, e, f) {}
bundle agent _method_reporting_context_v4(d, e, f) {}
bundle agent _classes_noop(a) {}
bundle agent log_rudder(message, class_parameter, old_class_prefix, class_prefix, args) {}

0 comments on commit dffc142

Please sign in to comment.