From: ss412g Date: Tue, 26 Nov 2019 15:16:40 +0000 (+0200) Subject: [RICPLT-2775] Fix unit tests X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F79%2F1779%2F1;p=ric-plt%2Fresource-status-manager.git [RICPLT-2775] Fix unit tests Change-Id: Ied26d5a95a4011de80175ef03b644ac6b685df45 Signed-off-by: ss412g --- diff --git a/RSM/configuration/configuration_test.go b/RSM/configuration/configuration_test.go index b00789a..48c39dd 100644 --- a/RSM/configuration/configuration_test.go +++ b/RSM/configuration/configuration_test.go @@ -61,7 +61,6 @@ func TestRmrConfigNotFoundFailure(t *testing.T) { yamlMap := map[string]interface{}{ "logging": map[string]interface{}{"logLevel": "info"}, "http": map[string]interface{}{"port": 631}, - "resourceStatusParams": map[string]interface{}{"enableResourceStatus": true, "periodicityCsiMs": 5}, "rnib": map[string]interface{}{"maxRnibConnectionAttempts": 3, "rnibRetryIntervalMs": 10}, } cleanUp := prepareTempConfigForTest(t, yamlMap) @@ -104,7 +103,6 @@ func TestRnibConfigNotFoundFailure(t *testing.T) { "rmr": map[string]interface{}{"port": 6942, "maxMsgSize": 4096}, "logging": map[string]interface{}{"logLevel": "info"}, "http": map[string]interface{}{"port": 631}, - "resourceStatusParams": map[string]interface{}{"enableResourceStatus": true, "periodicityCsiMs": 5}, } cleanUp := prepareTempConfigForTest(t, yamlMap) defer cleanUp() @@ -113,69 +111,6 @@ func TestRnibConfigNotFoundFailure(t *testing.T) { assert.EqualError(t, cErr, "#configuration.fillRnibConfig - failed to fill RNib configuration: The entry 'rnib' not found\n") } -func TestResourceStatusParamsConfigNotFoundFailure(t *testing.T) { - - yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 6942, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 631}, - "rnib": map[string]interface{}{"maxRnibConnectionAttempts": 3, "rnibRetryIntervalMs": 10}, - } - cleanUp := prepareTempConfigForTest(t, yamlMap) - defer cleanUp() - - _, cErr := ParseConfiguration() - assert.EqualError(t, cErr, "#configuration.fillResourceStatusParamsConfig - failed to fill resourceStatusParams configuration: The entry 'resourceStatusParams' not found\n") -} - -func TestCharacteristicsConfigInvalidPeriodicityMs(t *testing.T) { - - yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 6942, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 631}, - "rnib": map[string]interface{}{"maxRnibConnectionAttempts": 3, "rnibRetryIntervalMs": 10}, - "resourceStatusParams": map[string]interface{}{"enableResourceStatus": true, "periodicityMs": 50, "periodicityRsrpMeasurementMs": 480, "periodicityCsiMs": 20}, - } - cleanUp := prepareTempConfigForTest(t, yamlMap) - defer cleanUp() - - _, cErr := ParseConfiguration() - assert.Error(t, cErr) -} - -func TestResourceStatusParamsConfigInvalidPeriodicityRsrpMeasurementMs(t *testing.T) { - - yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 6942, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 631}, - "rnib": map[string]interface{}{"maxRnibConnectionAttempts": 3, "rnibRetryIntervalMs": 10}, - "resourceStatusParams": map[string]interface{}{"enableResourceStatus": true, "periodicityMs": 1000, "periodicityRsrpMeasurementMs": 50, "periodicityCsiMs": 20}, - } - cleanUp := prepareTempConfigForTest(t, yamlMap) - defer cleanUp() - - _, cErr := ParseConfiguration() - assert.Error(t, cErr) -} - -func TestResourceStatusParamsConfigInvalidPeriodicityCsiMs(t *testing.T) { - - yamlMap := map[string]interface{}{ - "rmr": map[string]interface{}{"port": 6942, "maxMsgSize": 4096}, - "logging": map[string]interface{}{"logLevel": "info"}, - "http": map[string]interface{}{"port": 631}, - "rnib": map[string]interface{}{"maxRnibConnectionAttempts": 3, "rnibRetryIntervalMs": 10}, - "resourceStatusParams": map[string]interface{}{"enableResourceStatus": true, "periodicityMs": 1000, "periodicityRsrpMeasurementMs": 480, "periodicityCsiMs": 50}, - } - cleanUp := prepareTempConfigForTest(t, yamlMap) - defer cleanUp() - - _, cErr := ParseConfiguration() - assert.Error(t, cErr) -} - func TestConfigurationString(t *testing.T) { config, err := ParseConfiguration() if err != nil { @@ -187,7 +122,6 @@ func TestConfigurationString(t *testing.T) { assert.Contains(t, str, "http") assert.Contains(t, str, "rmr") assert.Contains(t, str, "rnib") - assert.Contains(t, str, "resourceStatusParams") } func prepareTempConfigForTest(t *testing.T, yamlMap map[string]interface{}) func() { diff --git a/RSM/resources/configuration.yaml b/RSM/resources/configuration.yaml index 41407d6..a2bd2db 100644 --- a/RSM/resources/configuration.yaml +++ b/RSM/resources/configuration.yaml @@ -8,4 +8,4 @@ rmr: readyIntervalSec: 1 rnib: maxRnibConnectionAttempts: 3 - rnibRetryIntervalMs: 10 + rnibRetryIntervalMs: 10 \ No newline at end of file