• Hannes Hörl's avatar
    Add tests for `csiDriverClient` · 6330cee9
    Hannes Hörl authored
    As #69219 outlines the unit tests in `csi_client_test.go` where not
    testing the actual implementation of the `csiDriverClient` but was
    testing the fake.
    
    To fix this, we changed the `csiDriverClient` to use a
    `nodeClientCreator` which is responsible for creating a new
    `NodeClient`, a real one in prod and a fake one in the tests.
    
    The setup of the gRPC connection has been pushed into that creator. The
    node client uses that connection; that's transparent to the driver
    client. It's the responsibility of the driver client to close the
    connection when it is done with the node client. To achieve this, we
    have the node client creator return a closer which handles the
    connection teardown.
    
    In the tests we now also check if the driver client actually calls
    this closer, thus closing the gRPC connection.
    
    Closes: #69219
    Co-authored-by: 's avatarRosie Bloxsom <rbloxsom@pivotal.io>
    Co-authored-by: 's avatarMaria Ntalla <mntalla@pivotal.io>
    6330cee9