Skip to content

Commit

Permalink
Read the INTEROP_ROOT_FOLDER from an env var
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
  • Loading branch information
martin-g committed Sep 23, 2024
1 parent b831b99 commit b205a36
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/test-lang-rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,10 @@ jobs:
run: mvn -B -P interop-data-generate generate-resources

- name: Generate interop data
run: |
ln -s main-repo/build build
./build.sh interop-data-generate
run: INTEROP_ROOT_FOLDER="main-repo" ./build.sh interop-data-generate

- name: Rust reads interop files created by Java and Rust
run: ./build.sh interop-data-test
run: INTEROP_ROOT_FOLDER="main-repo" ./build.sh interop-data-test

- uses: shogo82148/actions-setup-perl@v1
with:
Expand Down
5 changes: 3 additions & 2 deletions avro/examples/generate_interop_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ fn create_datum(schema: &Schema) -> Record {
}

fn main() -> Result<(), Box<dyn Error>> {
let schema_str = std::fs::read_to_string("../../share/test/schemas/interop.avsc")
let interop_root_folder: String = env::var("INTEROP_ROOT_FOLDER")?;
let schema_str = std::fs::read_to_string(format!("{interop_root_folder}/share/test/schemas/interop.avsc"))
.expect("Unable to read the interop Avro schema");
let schema = Schema::parse_str(schema_str.as_str())?;
let data_folder = "../../build/interop/data";
let data_folder = format!("{interop_root_folder}/build/interop/data");
std::fs::create_dir_all(data_folder)?;

for codec in Codec::iter() {
Expand Down
3 changes: 2 additions & 1 deletion avro/examples/test_interop_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ fn main() -> Result<(), Box<dyn Error>> {
let mut expected_user_metadata: HashMap<String, Vec<u8>> = HashMap::new();
expected_user_metadata.insert("user_metadata".to_string(), b"someByteArray".to_vec());

let data_dir = std::fs::read_dir("../../build/interop/data/")
let interop_root_folder: String = env::var("INTEROP_ROOT_FOLDER")?;
let data_dir = std::fs::read_dir(format!("{interop_root_folder}/build/interop/data/"))
.expect("Unable to list the interop data directory");

let mut errors = Vec::new();
Expand Down

0 comments on commit b205a36

Please sign in to comment.