diff --git a/cli/context/store/store.go b/cli/context/store/store.go index 56554dd01a..97a2d93ea6 100644 --- a/cli/context/store/store.go +++ b/cli/context/store/store.go @@ -186,7 +186,7 @@ func (s *store) ListTLSFiles(name string) (map[string]EndpointFiles, error) { } func (s *store) GetTLSData(contextName, endpointName, fileName string) ([]byte, error) { - res, err := s.tls.getData(contextdirOf(contextName), endpointName, fileName) + res, err := s.tls.getData(contextName, endpointName, fileName) return res, patchErrContextName(err, contextName) } diff --git a/cli/context/store/tlsstore.go b/cli/context/store/tlsstore.go index 47303607e4..ec1dd43de2 100644 --- a/cli/context/store/tlsstore.go +++ b/cli/context/store/tlsstore.go @@ -36,8 +36,8 @@ func (s *tlsStore) createOrUpdate(name, endpointName, filename string, data []by return os.WriteFile(s.filePath(contextID, endpointName, filename), data, 0600) } -func (s *tlsStore) getData(contextID contextdir, endpointName, filename string) ([]byte, error) { - data, err := os.ReadFile(s.filePath(contextID, endpointName, filename)) +func (s *tlsStore) getData(name, endpointName, filename string) ([]byte, error) { + data, err := os.ReadFile(s.filePath(contextdirOf(name), endpointName, filename)) if err != nil { return nil, convertTLSDataDoesNotExist(endpointName, filename, err) } diff --git a/cli/context/store/tlsstore_test.go b/cli/context/store/tlsstore_test.go index 9b1606b809..66b3d4ffd7 100644 --- a/cli/context/store/tlsstore_test.go +++ b/cli/context/store/tlsstore_test.go @@ -12,17 +12,17 @@ func TestTlsCreateUpdateGetRemove(t *testing.T) { const contextName = "test-ctx" contextID := contextdirOf(contextName) - _, err := testee.getData(contextID, "test-ep", "test-data") + _, err := testee.getData(contextName, "test-ep", "test-data") assert.Equal(t, true, IsErrTLSDataDoesNotExist(err)) err = testee.createOrUpdate(contextName, "test-ep", "test-data", []byte("data")) assert.NilError(t, err) - data, err := testee.getData(contextID, "test-ep", "test-data") + data, err := testee.getData(contextName, "test-ep", "test-data") assert.NilError(t, err) assert.Equal(t, string(data), "data") err = testee.createOrUpdate(contextName, "test-ep", "test-data", []byte("data2")) assert.NilError(t, err) - data, err = testee.getData(contextID, "test-ep", "test-data") + data, err = testee.getData(contextName, "test-ep", "test-data") assert.NilError(t, err) assert.Equal(t, string(data), "data2") @@ -31,7 +31,7 @@ func TestTlsCreateUpdateGetRemove(t *testing.T) { err = testee.remove(contextID, "test-ep", "test-data") assert.NilError(t, err) - _, err = testee.getData(contextID, "test-ep", "test-data") + _, err = testee.getData(contextName, "test-ep", "test-data") assert.Equal(t, true, IsErrTLSDataDoesNotExist(err)) }