My code is simply:
func Test_DecodeLBPolicy(t *testing.T) {
policy := decodeLBPolicy("lb:RING_HASH")
require.Equal(t, api.RING_HASH, policy.Type)
require.Equal(t, nil, decodeLBPolicy(""))
}
problem occurs at last line, the output is as below:
Error: Not equal:
expected: <nil>(<nil>)
actual : *api.LBPolicy(nil)
then I tried to replace expected "nil" to "*api.LBPolicy(nil)" it wont compile but when I change the require to require.Equal(t, true, decodeLBPolicy("") == nil) it passed.