Commit Graph

6 Commits

Author SHA1 Message Date
gotjosh
fbb027752f Refactor if/else into a switch statement
Also, extracts strings into constants
2018-11-01 20:42:27 +00:00
gotjosh
3faf109b8f Fix intention of support for endpoints without protocols
When we receive an endpoint address without a protocol, our code states we
don't support them and that the format is deprecated.

In reality it was not the case, e.g:

When we received an address in the form of `127.0.0.1`, we'd attempt to
parse the scheme from it, we'd realise is does have one (would be
equivalent to "") and our function `parseEndpoint` would return `"", "", fmt.Error`.

Then, our `parseEndpointWithFallbackProtocol` would use the
fallback protocol (unix) and attempt to connect to `unix://127.0.0.1`.

This meant two things:

1. The error returned from `parseEndpoint` would never be thrown
2. We would connect anyways since the address is valid

This commit changes the assertion logic to match the intention of using
a fallback protocol when one is not supplied.
2018-11-01 20:21:54 +00:00
gotjosh
beeb27810c Add tests for probe/cri/registry
Unhappy path tests try to cover three scenarios:

- When the endpoint URL scheme is not explicitly supported e.g. HTTP
- When the endpoint URL scheme is TCP which is also not supported
- When the fail to parse the given URL (to extract the scheme)

The happy path covers two scenarios:

- When we specify the supported scheme in the URL which is an unix
socket e.g. unix///var/run/dockershim.sock
- When we pass a socket address but fail to specify the scheme but our registry attempts
to use the fallback protocol e.g. var/run/dockershim.sock
2018-11-01 20:17:03 +00:00
Ajay Kelkar
68bce4f57c Using assert for equality checks 2018-10-03 14:19:54 +05:30
Ajay Kelkar
27a0b2460d Absolute basic UT 2018-10-01 21:26:26 +05:30
Lili Cosic
e6d9bcc1cb Add CRI probe
When the probe.cri is enabled the CRI probe will be used to gather
the container information via the CRI API. For now only the basic
information is included in the generated report, those that we can get
via the CRI ListContainersRequest.
2018-07-26 10:51:59 +01:00