2021-10-27 10:00:35 +00:00
|
|
|
package netmap
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2022-06-07 08:25:34 +00:00
|
|
|
func TestNodeInfo_SetAttribute(t *testing.T) {
|
|
|
|
var n NodeInfo
|
2021-10-27 10:00:35 +00:00
|
|
|
|
2022-06-07 08:25:34 +00:00
|
|
|
const key = "some key"
|
2021-10-27 10:00:35 +00:00
|
|
|
val := "some value"
|
|
|
|
|
2022-06-07 08:25:34 +00:00
|
|
|
require.Zero(t, n.Attribute(val))
|
2021-10-27 10:00:35 +00:00
|
|
|
|
2022-06-07 08:25:34 +00:00
|
|
|
n.SetAttribute(key, val)
|
|
|
|
require.Equal(t, val, n.Attribute(key))
|
2021-10-27 10:00:35 +00:00
|
|
|
|
2022-06-07 08:25:34 +00:00
|
|
|
val = "some other value"
|
2021-10-27 10:00:35 +00:00
|
|
|
|
2022-06-07 08:25:34 +00:00
|
|
|
n.SetAttribute(key, val)
|
|
|
|
require.Equal(t, val, n.Attribute(key))
|
2021-10-27 10:00:35 +00:00
|
|
|
}
|