-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Disk Manager] Refactoring: use testing client for dm integration tests #2894
base: main
Are you sure you want to change the base?
[Disk Manager] Refactoring: use testing client for dm integration tests #2894
Conversation
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/types" | ||
"github.com/ydb-platform/nbs/cloud/tasks/logging" | ||
"golang.org/x/sync/errgroup" | ||
) | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
func (c *client) FillDisk( | ||
type testingClient struct { | ||
client *client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут нужно использовать именно тип client, а не интерфейс Client, так как в методах нужно будет иметь доступ к полю nbs структуры client.
Чтобы иметь возможность положить сюда client, пришлось чуть подрефакторить код фабрики. А именно, рядом с методом factory.GetClient добавил неэкспортированный метод factory.getClient, который возвращает client вместо Client.
type partitionInfo struct { | ||
Checkpoints []checkpoint `json:"Checkpoints"` | ||
// We don't need other partitionInfo fields. | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Эти две структуры нигде не использовались. Не знаю, для чего они тут были)
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
func (c *testingClient) Ping(ctx context.Context) (err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Все методы, которые есть в интерфейсе Client, полностью делегируются.
Реализации остальных методов в точности перенесены из client, за тем исключением, что где-то вметсо c.nbs стало c.client.nbs.
0cf268a
to
b1db1fe
Compare
#892
Added TestingClient interface and used it in tests where needed.