diff --git a/cli/context/store/tlsstore.go b/cli/context/store/tlsstore.go index ec1dd43de2..777c9c04f0 100644 --- a/cli/context/store/tlsstore.go +++ b/cli/context/store/tlsstore.go @@ -44,8 +44,10 @@ func (s *tlsStore) getData(name, endpointName, filename string) ([]byte, error) return data, nil } -func (s *tlsStore) remove(contextID contextdir, endpointName, filename string) error { - err := os.Remove(s.filePath(contextID, endpointName, filename)) +// remove removes a TLS data from an endpoint +// TODO(thaJeztah) tlsStore.remove() is not used anywhere outside of tests; should we use removeAllEndpointData() only? +func (s *tlsStore) remove(name, endpointName, filename string) error { + err := os.Remove(s.filePath(contextdirOf(name), endpointName, filename)) if os.IsNotExist(err) { return nil } diff --git a/cli/context/store/tlsstore_test.go b/cli/context/store/tlsstore_test.go index 66b3d4ffd7..3f6b6c4443 100644 --- a/cli/context/store/tlsstore_test.go +++ b/cli/context/store/tlsstore_test.go @@ -10,7 +10,6 @@ func TestTlsCreateUpdateGetRemove(t *testing.T) { testee := tlsStore{root: t.TempDir()} const contextName = "test-ctx" - contextID := contextdirOf(contextName) _, err := testee.getData(contextName, "test-ep", "test-data") assert.Equal(t, true, IsErrTLSDataDoesNotExist(err)) @@ -26,9 +25,9 @@ func TestTlsCreateUpdateGetRemove(t *testing.T) { assert.NilError(t, err) assert.Equal(t, string(data), "data2") - err = testee.remove(contextID, "test-ep", "test-data") + err = testee.remove(contextName, "test-ep", "test-data") assert.NilError(t, err) - err = testee.remove(contextID, "test-ep", "test-data") + err = testee.remove(contextName, "test-ep", "test-data") assert.NilError(t, err) _, err = testee.getData(contextName, "test-ep", "test-data")