Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -714,4 +714,38 @@ public async Task TestEvents()
Times.Once()
);
}

[TestMethod]
public void TestNewClusterEventTypesDeserialization()
{
// Test that all new ClusterEventType values can be deserialized correctly
var newEventTypes = new[]
{
"NODE_BLACKLISTED",
"PINNED",
"UNPINNED",
"NODE_EXCLUDED_DECOMMISSIONED",
"ADD_NODES_FAILED",
"AUTOSCALING_BACKOFF",
"AUTOMATIC_CLUSTER_UPDATE",
"AUTOSCALING_FAILED",
"DECOMMISSION_STARTED",
"DECOMMISSION_ENDED"
};

foreach (var eventType in newEventTypes)
{
var json = $@"
{{
""cluster_id"": ""test-cluster"",
""timestamp"": 1619471498409,
""type"": ""{eventType}"",
""details"": {{}}
}}";

var clusterEvent = JsonSerializer.Deserialize<ClusterEvent>(json, Options);
Assert.IsNotNull(clusterEvent, $"Failed to deserialize ClusterEvent with type {eventType}");
Assert.AreEqual(eventType, clusterEvent.Type.ToString(), $"ClusterEventType {eventType} did not deserialize correctly");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,55 @@ public enum ClusterEventType
/// <summary>
/// Usage report containing the total and unused instance minutes of the autoscaling cluster over the last hour.
/// </summary>
AUTOSCALING_STATS_REPORT
AUTOSCALING_STATS_REPORT,

/// <summary>
/// Indicates that a node has been blacklisted.
/// </summary>
NODE_BLACKLISTED,

/// <summary>
/// Indicates that a cluster has been pinned.
/// </summary>
PINNED,

/// <summary>
/// Indicates that a cluster has been unpinned.
/// </summary>
UNPINNED,

/// <summary>
/// Indicates that a node has been excluded or decommissioned.
/// </summary>
NODE_EXCLUDED_DECOMMISSIONED,

/// <summary>
/// Indicates that adding nodes to the cluster has failed.
/// </summary>
ADD_NODES_FAILED,

/// <summary>
/// Indicates that autoscaling has been backed off.
/// </summary>
AUTOSCALING_BACKOFF,

/// <summary>
/// Indicates that the cluster has been automatically updated.
/// </summary>
AUTOMATIC_CLUSTER_UPDATE,

/// <summary>
/// Indicates that autoscaling has failed.
/// </summary>
AUTOSCALING_FAILED,

/// <summary>
/// Indicates that node decommissioning has started.
/// </summary>
DECOMMISSION_STARTED,

/// <summary>
/// Indicates that node decommissioning has ended.
/// </summary>
DECOMMISSION_ENDED
}