Remove sleep from tests
This commit is contained in:
parent
78a44239e9
commit
73e35fd048
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"mime/quotedprintable"
|
"mime/quotedprintable"
|
||||||
|
"net"
|
||||||
"regexp"
|
"regexp"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -77,6 +78,8 @@ func (s *testSession) Data(r io.Reader) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println(string(b))
|
||||||
|
|
||||||
res := re.FindAllStringSubmatch(string(b), -1)
|
res := re.FindAllStringSubmatch(string(b), -1)
|
||||||
|
|
||||||
if smtpEvent.Jenkins.Name == res[0][1] {
|
if smtpEvent.Jenkins.Name == res[0][1] {
|
||||||
|
|
@ -132,13 +135,13 @@ func TestSMTP_Send(t *testing.T) {
|
||||||
err := fakeClient.Create(context.TODO(), secret)
|
err := fakeClient.Create(context.TODO(), secret)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
go func() {
|
l, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", testSMTPPort))
|
||||||
if err := s.ListenAndServe(); err != nil {
|
assert.NoError(t, err)
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
time.Sleep(time.Second * 5)
|
go func() {
|
||||||
|
err := s.Serve(l)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}()
|
||||||
|
|
||||||
err = smtpClient.Send(smtpEvent, v1alpha2.Notification{
|
err = smtpClient.Send(smtpEvent, v1alpha2.Notification{
|
||||||
SMTP: &v1alpha2.SMTP{
|
SMTP: &v1alpha2.SMTP{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue