Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
P
parlote-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
parlote-facil
Validations
62cb1f99
Non vérifiée
Valider
62cb1f99
rédigé
7 years ago
par
Benjamin Neff
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Get current time before the test to be safer on MySQL
parent
605e2925
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
spec/models/pod_spec.rb
+11
-8
11 ajouts, 8 suppressions
spec/models/pod_spec.rb
avec
11 ajouts
et
8 suppressions
spec/models/pod_spec.rb
+
11
−
8
Voir le fichier @
62cb1f99
...
@@ -142,6 +142,7 @@ describe Pod, type: :model do
...
@@ -142,6 +142,7 @@ describe Pod, type: :model do
before
do
before
do
@pod
=
FactoryGirl
.
create
(
:pod
)
@pod
=
FactoryGirl
.
create
(
:pod
)
@result
=
double
(
"result"
)
@result
=
double
(
"result"
)
@now
=
Time
.
zone
.
now
allow
(
@result
).
to
receive
(
:rt
)
{
123
}
allow
(
@result
).
to
receive
(
:rt
)
{
123
}
allow
(
@result
).
to
receive
(
:software_version
)
{
"diaspora a.b.c.d"
}
allow
(
@result
).
to
receive
(
:software_version
)
{
"diaspora a.b.c.d"
}
...
@@ -158,7 +159,7 @@ describe Pod, type: :model do
...
@@ -158,7 +159,7 @@ describe Pod, type: :model do
expect
(
@pod
.
status
).
to
eq
(
"no_errors"
)
expect
(
@pod
.
status
).
to
eq
(
"no_errors"
)
expect
(
@pod
.
offline?
).
to
be_falsy
expect
(
@pod
.
offline?
).
to
be_falsy
expect
(
@pod
.
response_time
).
to
eq
(
123
)
expect
(
@pod
.
response_time
).
to
eq
(
123
)
expect
(
@pod
.
checked_at
).
to
be_within
(
1
.
second
).
of
Time
.
zone
.
now
expect
(
@pod
.
checked_at
).
to
be_within
(
1
.
second
).
of
@
now
end
end
it
"resets the scheduled_check flag"
do
it
"resets the scheduled_check flag"
do
...
@@ -177,7 +178,7 @@ describe Pod, type: :model do
...
@@ -177,7 +178,7 @@ describe Pod, type: :model do
@pod
.
test_connection!
@pod
.
test_connection!
expect
(
@pod
.
offline?
).
to
be_truthy
expect
(
@pod
.
offline?
).
to
be_truthy
expect
(
@pod
.
offline_since
).
to
be_within
(
1
.
second
).
of
Time
.
zone
.
now
expect
(
@pod
.
offline_since
).
to
be_within
(
1
.
second
).
of
@
now
end
end
it
"preserves the original offline timestamp"
do
it
"preserves the original offline timestamp"
do
...
@@ -185,13 +186,12 @@ describe Pod, type: :model do
...
@@ -185,13 +186,12 @@ describe Pod, type: :model do
expect
(
@result
).
to
receive
(
:error
).
at_least
(
:once
)
{
ConnectionTester
::
NetFailure
.
new
}
expect
(
@result
).
to
receive
(
:error
).
at_least
(
:once
)
{
ConnectionTester
::
NetFailure
.
new
}
@pod
.
test_connection!
@pod
.
test_connection!
now
=
Time
.
zone
.
now
expect
(
@pod
.
offline_since
).
to
be_within
(
1
.
second
).
of
@now
expect
(
@pod
.
offline_since
).
to
be_within
(
1
.
second
).
of
now
Timecop
.
travel
(
Time
.
zone
.
today
+
30
.
days
)
do
Timecop
.
travel
(
Time
.
zone
.
today
+
30
.
days
)
do
@pod
.
test_connection!
@pod
.
test_connection!
expect
(
@pod
.
offline_since
).
to
be_within
(
1
.
second
).
of
now
expect
(
@pod
.
offline_since
).
to
be_within
(
1
.
second
).
of
@
now
expect
(
Time
.
zone
.
now
).
to
be_within
(
1
.
day
).
of
(
now
+
30
.
days
)
expect
(
Time
.
zone
.
now
).
to
be_within
(
1
.
day
).
of
(
@
now
+
30
.
days
)
end
end
end
end
end
end
...
@@ -215,19 +215,22 @@ describe Pod, type: :model do
...
@@ -215,19 +215,22 @@ describe Pod, type: :model do
end
end
it
"handles a failed status"
do
it
"handles a failed status"
do
now
=
Time
.
zone
.
now
pod
.
status
=
:unknown_error
pod
.
status
=
:unknown_error
pod
.
update_offline_since
pod
.
update_offline_since
expect
(
pod
.
offline?
).
to
be_truthy
expect
(
pod
.
offline?
).
to
be_truthy
expect
(
pod
.
offline_since
).
to
be_within
(
1
.
second
).
of
Time
.
zone
.
now
expect
(
pod
.
offline_since
).
to
be_within
(
1
.
second
).
of
now
end
end
it
"preserves the original offline timestamp"
do
it
"preserves the original offline timestamp"
do
now
=
Time
.
zone
.
now
pod
.
status
=
:unknown_error
pod
.
status
=
:unknown_error
pod
.
update_offline_since
pod
.
update_offline_since
pod
.
save
pod
.
save
now
=
Time
.
zone
.
now
expect
(
pod
.
offline_since
).
to
be_within
(
1
.
second
).
of
now
expect
(
pod
.
offline_since
).
to
be_within
(
1
.
second
).
of
now
Timecop
.
travel
(
Time
.
zone
.
today
+
30
.
days
)
do
Timecop
.
travel
(
Time
.
zone
.
today
+
30
.
days
)
do
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter