Skip to content

Commit

Permalink
Update AgentKind enum variants
Browse files Browse the repository at this point in the history
- Rename previous enum variants to align with review-database
- Add `TimeSeriesGenerator` variant

Close: #351
  • Loading branch information
danbi2990 committed Nov 8, 2024
1 parent 455758d commit 2c185de
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 95 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Added the `TimeSeriesGenerator` variant to the `AgentKind` enum.

### Changed

- Modified `applyNode` GraphQL API logic to prevent notifying agents that are
operating with local configuration.
- Updated review-database to commit hash aaab9e78.
- Renamed `AgentKind` enum variants to align with review-database.

## [0.23.0] - 2024-10-23

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ num-traits = "0.2"
reqwest = { version = "0.12", default-features = false, features = [
"rustls-tls-native-roots",
] }
review-database = { git = "https://github.com/petabi/review-database.git", tag = "0.31.0" }
review-database = { git = "https://github.com/petabi/review-database.git", rev = "aaab9e78" }
roxy = { git = "https://github.com/aicers/roxy.git", tag = "0.3.0" }
rustls = { version = "0.23", default-features = false, features = [
"ring",
Expand Down
4 changes: 2 additions & 2 deletions src/graphql/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ mod tests {
hostname: "collector1",
agents: [{
key: "piglet"
kind: PIGLET
kind: SENSOR
status: ENABLED
}]
giganto: null
Expand All @@ -1324,7 +1324,7 @@ mod tests {
agents: [
{
key: "piglet",
kind: "PIGLET",
kind: "SENSOR",
status: "ENABLED"
}
],
Expand Down
7 changes: 4 additions & 3 deletions src/graphql/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ impl TryFrom<&NicInput> for Nic {
#[derive(Clone, Deserialize, PartialEq, Serialize, Copy, Eq, Enum)]
#[graphql(remote = "database::AgentKind")]
pub enum AgentKind {
Reconverge,
Piglet,
Hog,
Unsupervised,
Sensor,
SemiSupervised,
TimeSeriesGenerator,
}

#[derive(Clone, PartialEq, Deserialize, Serialize, Enum, Copy, Eq)]
Expand Down
107 changes: 54 additions & 53 deletions src/graphql/node/control.rs

Large diffs are not rendered by default.

38 changes: 20 additions & 18 deletions src/graphql/node/crud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ mod tests {

// test scenario : insert node -> update node with different name -> remove node
#[tokio::test]
#[allow(clippy::too_many_lines)]
async fn node_crud() {
let schema = TestSchema::new().await;

Expand All @@ -216,12 +217,12 @@ mod tests {
hostname: "admin.aice-security.com",
agents: [{
key: "reconverge"
kind: RECONVERGE
kind: UNSUPERVISED
status: ENABLED
},
{
key: "piglet"
kind: PIGLET
kind: SENSOR
status: ENABLED
}]
giganto: null
Expand Down Expand Up @@ -280,12 +281,12 @@ mod tests {
},
"agents": [{
"key": "reconverge",
"kind": "RECONVERGE",
"kind": "UNSUPERVISED",
"status": "ENABLED",
},
{
"key": "piglet",
"kind": "PIGLET",
"kind": "SENSOR",
"status": "ENABLED",
}],
"giganto": null
Expand All @@ -311,14 +312,14 @@ mod tests {
agents: [
{
key: "reconverge",
kind: "RECONVERGE",
kind: "UNSUPERVISED",
status: "ENABLED",
config: null,
draft: null
},
{
key: "piglet",
kind: "PIGLET",
kind: "SENSOR",
status: "ENABLED",
config: null,
draft: null
Expand All @@ -336,14 +337,14 @@ mod tests {
agents: [
{
key: "reconverge",
kind: "RECONVERGE",
kind: "UNSUPERVISED",
status: "ENABLED",
config: null,
draft: null
},
{
key: "piglet",
kind: "PIGLET",
kind: "SENSOR",
status: "ENABLED",
config: null,
draft: null
Expand Down Expand Up @@ -418,14 +419,14 @@ mod tests {
agents: [
{
key: "reconverge",
kind: "RECONVERGE",
kind: "UNSUPERVISED",
status: "ENABLED",
config: null,
draft: null
},
{
key: "piglet",
kind: "PIGLET",
kind: "SENSOR",
status: "ENABLED",
config: null,
draft: null
Expand Down Expand Up @@ -461,6 +462,7 @@ mod tests {
}

#[tokio::test]
#[allow(clippy::too_many_lines)]
async fn update_node_name() {
let schema = TestSchema::new().await;

Expand All @@ -479,12 +481,12 @@ mod tests {
hostname: "admin.aice-security.com",
agents: [{
key: "reconverge"
kind: RECONVERGE
kind: UNSUPERVISED
status: ENABLED
},
{
key: "piglet"
kind: PIGLET
kind: SENSOR
status: ENABLED
}]
giganto: null
Expand Down Expand Up @@ -543,12 +545,12 @@ mod tests {
},
"agents": [{
"key": "reconverge",
"kind": "RECONVERGE",
"kind": "UNSUPERVISED",
"status": "ENABLED",
},
{
"key": "piglet",
"kind": "PIGLET",
"kind": "SENSOR",
"status": "ENABLED",
}],
"giganto": null
Expand All @@ -574,14 +576,14 @@ mod tests {
agents: [
{
key: "reconverge",
kind: "RECONVERGE",
kind: "UNSUPERVISED",
status: "ENABLED",
config: null,
draft: null
},
{
key: "piglet",
kind: "PIGLET",
kind: "SENSOR",
status: "ENABLED",
config: null,
draft: null
Expand All @@ -594,14 +596,14 @@ mod tests {
agents: [
{
key: "reconverge",
kind: "RECONVERGE",
kind: "UNSUPERVISED",
status: "ENABLED",
config: null,
draft: null
},
{
key: "piglet",
kind: "PIGLET",
kind: "SENSOR",
status: "ENABLED",
config: null,
draft: null
Expand Down
36 changes: 18 additions & 18 deletions src/graphql/node/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ mod tests {
agents: [
{{
key: "features"
kind: PIGLET
kind: SENSOR
status: ENABLED
draft: "my_val=1"
}}
Expand Down Expand Up @@ -264,7 +264,7 @@ mod tests {
agents: [
{{
key: "features"
kind: PIGLET
kind: SENSOR
status: ENABLED
config: null
draft: "my_val=1"
Expand All @@ -290,13 +290,13 @@ mod tests {
hostname: "analysis",
agents: [{
key: "learner"
kind: RECONVERGE
kind: UNSUPERVISED
status: ENABLED
draft: "my_val=2"
},
{
key: "models"
kind: HOG
kind: SEMI_SUPERVISED
status: ENABLED
draft: "my_val=2"
}]
Expand All @@ -323,14 +323,14 @@ mod tests {
},
agents: [{
key: "learner"
kind: RECONVERGE
kind: UNSUPERVISED
status: ENABLED
config: null
draft: "my_val=2"
},
{
key: "models"
kind: HOG
kind: SEMI_SUPERVISED
status: ENABLED
config: null
draft: "my_val=2"
Expand Down Expand Up @@ -407,7 +407,7 @@ mod tests {
"manager": true,
"agents": [
{
"kind": "PIGLET",
"kind": "SENSOR",
"storedStatus": "ENABLED",
"config": "my_val=1",
"draft": "my_val=1",
Expand Down Expand Up @@ -439,13 +439,13 @@ mod tests {
"manager": false,
"agents": [
{
"kind": "RECONVERGE",
"kind": "UNSUPERVISED",
"storedStatus": "ENABLED",
"config": "my_val=2",
"draft": "my_val=2"
},
{
"kind": "HOG",
"kind": "SEMI_SUPERVISED",
"storedStatus": "ENABLED",
"config": "my_val=2",
"draft": "my_val=2"
Expand Down Expand Up @@ -486,12 +486,12 @@ mod tests {
hostname: "admin.aice-security.com",
agents: [{
key: "learner"
kind: RECONVERGE
kind: UNSUPERVISED
status: ENABLED
},
{
key: "models"
kind: HOG
kind: SEMI_SUPERVISED
status: ENABLED
}]
giganto: null
Expand All @@ -511,12 +511,12 @@ mod tests {
hostname: "admin.aice-security.com",
agents: [{
key: "learner"
kind: RECONVERGE
kind: UNSUPERVISED
status: ENABLED
},
{
key: "models"
kind: HOG
kind: SEMI_SUPERVISED
status: ENABLED
}]
giganto: null
Expand All @@ -536,12 +536,12 @@ mod tests {
hostname: "admin.aice-security.com",
agents: [{
key: "learner"
kind: RECONVERGE
kind: UNSUPERVISED
status: ENABLED
},
{
key: "models"
kind: HOG
kind: SEMI_SUPERVISED
status: ENABLED
}]
giganto: null
Expand All @@ -561,12 +561,12 @@ mod tests {
hostname: "admin.aice-security.com",
agents: [{
key: "learner"
kind: RECONVERGE
kind: UNSUPERVISED
status: ENABLED
},
{
key: "models"
kind: HOG
kind: SEMI_SUPERVISED
status: ENABLED
}]
giganto: null
Expand All @@ -586,7 +586,7 @@ mod tests {
hostname: "admin.aice-security.com",
agents: [{
key: "features@collect"
kind: PIGLET
kind: SENSOR
status: ENABLED
}]
giganto: null
Expand Down

0 comments on commit 2c185de

Please sign in to comment.