Skip to content

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

Merged
merged 8 commits into from
Apr 20, 2018
Merged

Qa 7710 #25

merged 8 commits into from
Apr 20, 2018

Conversation

podtserkovskiy
Copy link
Member

No description provided.

}

func NewNode(
key string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А за что отвечает ключ?

Copy link
Member Author

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 {
Copy link
Member

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

Copy link
Member Author

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)
Copy link
Member

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 )))) наверно надо тоже в конфиг засунуть

Copy link
Member Author

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 секунды и если человек поставит маленький таймаут то он никогда не дождется результата

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет, он просто все время с таймаутом будет валиться, валидируй тогда значение на входе

Copy link
Member Author

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ВЫше описал.

err := p.clientset.CoreV1Client.Pods(p.namespace).Delete(podName, &apiV1.DeleteOptions{})
if err != nil {
switch {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что-то ты увлекся свичами, наверно вложенные условия логичнее.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и то и то выглядит не очень 😩, но свич на мой вгляд проще читать

Copy link
Member

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())
}

Выглядет сто пудов л��чше.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏿

if err != nil {
_ = s.provider.Destroy(podName) // на случай если что то успело создасться
go func(podName string) {
time.Sleep(time.Minute * 2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ух ты, я сейчас Эду напишу, он тебе там с Лехой айайай устроят)))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

хардкод в данном случае - это норма в конфиге он довольно бесполезен

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я не говорю про конфиг, етсь константы с именем, что бы было ясно откуда 2 минуты и есть соотвественно вопрос, почему 2 минуты?

Copy link
Member Author

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
}
Copy link
Member

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")
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это контроллируется на уровне индекса в бд

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@podtserkovskiy podtserkovskiy merged commit f3b3799 into master Apr 20, 2018
@podtserkovskiy podtserkovskiy deleted the QA-7710 branch April 20, 2018 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants