Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - SmartModule package: add missing metadata #2532

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/cd_dev_mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
- name: Install Docker for Mac
if: ${{ matrix.os == 'macos-12' }}
uses: docker-practice/actions-setup-docker@master
timeout-minutes: 5
- name: Set up Kind for Mac
if: ${{ matrix.os == 'macos-12' }}
run: |
Expand Down
20 changes: 18 additions & 2 deletions crates/fluvio-smartmodule-package/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ impl SmartModuleMetadata {
pub struct Package {
pub name: String,
pub group: String,
pub version: String,
pub package_version: String,
pub description: String,
#[serde(default)]
pub authors: Vec<String>,
pub license: String,
pub repository: String,
}

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub enum InitType {
String,
Expand All @@ -51,7 +53,21 @@ mod test {

#[test]
fn test_pkg_parser() {
let _metadata = super::SmartModuleMetadata::from_file("tests/regex.toml")
let metadata = super::SmartModuleMetadata::from_file("tests/regex.toml")
.expect("failed to parse metadata");
assert_eq!(metadata.package.name, "regex");
assert_eq!(metadata.package.version, "0.1.0");
assert_eq!(metadata.package.description, "Regex SmartModule");
assert_eq!(metadata.package.authors.len(), 1);
assert_eq!(metadata.package.authors[0], "Infinyon");
assert_eq!(metadata.package.package_version, "0.1");
assert_eq!(metadata.package.license, "Apache-2.0");
assert_eq!(
metadata.package.repository,
"https://github.com/infinyon/fluvio"
);
let init_param = metadata.init;
assert_eq!(init_param.len(), 1);
assert_eq!(init_param["regex"].input, super::InitType::String);
}
}