-
Notifications
You must be signed in to change notification settings - Fork 10
Qa 7710 #25
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
Qa 7710 #25
Conversation
} | ||
|
||
func NewNode( | ||
key string, |
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.
А за что отвечает ключ?
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.
добавил комент в код
уникальный ключ, по которому мы понимаем как нам найти этот объект во внешнем мире + за то чтобы не добавить второй раз одно и то же
значение может зависеть от стратегии
для постоянных нод ip:port
для временных pod.name
PodCreationTimeout time.Duration | ||
} | ||
|
||
func (sp *strategyParams) UnmarshalJSON(b []byte) 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.
Выглядет так что тебе нужно добавить валидацию конфигов и тип type CfgDuration string
с методом getStdlibDuration() time.Duration
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.
нужно координально все связанное с конфигами переделать, пока предлагаю оставить так как временное решение и вернуться к этому позже
case <-stop: | ||
return "", fmt.Errorf("wait podIP stopped by timeout, %v", podName) | ||
default: | ||
time.Sleep(time.Second) |
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.
А что будет если человек по не знанию поставит p.podCreationTimeout = 500 * time.MIliseconds
)))) наверно надо тоже в конфиг засунуть
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.
в конфиг засовывать не стоит, так как это его лишь усложнит его
сейчас пользователь просто повисит секунду + время на запрос в куб вместо 1/2 секунды, ничего страшного не пройзойдет
если мы хотим управлять частотой опроса можно делать это так req_f = podCreationTimeout / 3 если podCreationTimeout < 3 sec
но в этом тоже не много смысла, ибо время создания селениума в кубе всегда больше 1 секунды и если человек поставит маленький таймаут то он никогда не дождется результата
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.
Нет, он просто все время с таймаутом будет валиться, валидируй тогда значение на входе
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.
возникает вопрос какой таймаут считать минимальным и нужно ли это?
до первого issue будем верить в осознанность пользователей
for { | ||
select { | ||
case <-stop: | ||
return errors.New("wait stopped by timeout") | ||
return "", fmt.Errorf("wait selenium stopped by timeout, %v", podName) | ||
default: | ||
time.Sleep(time.Second) |
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.
ВЫше описал.
pool/strategy/kubernetes/provider.go
Outdated
err := p.clientset.CoreV1Client.Pods(p.namespace).Delete(podName, &apiV1.DeleteOptions{}) | ||
if err != nil { | ||
switch { |
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.
Что-то ты увлекся свичами, наверно вложенные условия логичнее.
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.
и то и то выглядит не очень 😩, но свич на мой вгляд проще читать
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.
if err != nil && !errHelper.HasNotFound(err) {
return errors.New("send command pod/delete to k8s, " + err.Error())
}
// or
if err != nil && !strings.Contains(err.Error(), "not found") {
return errors.New("send command pod/delete to k8s, " + 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.
👍🏿
pool/strategy/kubernetes/strategy.go
Outdated
if err != nil { | ||
_ = s.provider.Destroy(podName) // на случай если что то успело создасться | ||
go func(podName string) { | ||
time.Sleep(time.Minute * 2) |
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.
Ух ты, я сейчас Эду напишу, он тебе там с Лехой айайай устроят)))
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.
хардкод в данном случае - это норма в конфиге он довольно бесполезен
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.
Я не говорю про конфиг, етсь константы с именем, что бы было ясно откуда 2 минуты и есть соотвественно вопрос, почему 2 минуты?
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.
вынес в константу
сделано так как есть предположение, что у нас может отвалиться ответ от апи но тем не менее под создастся
2 минуты взяты с потолка, я предполагаю что их хватит, в процессе эксплуатации поймем так это или нет
} | ||
if rowsAffected == 0 { | ||
return storage.ErrNotFound | ||
} |
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.
if rowsAffected > 1 {
return errors.New("have got two rows for one key")
}
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.
это контроллируется на уровне индекса в бд
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.
Ok
No description provided.