Skip to content
Snippets Groups Projects
Commit c9c0a2ef authored by Changgang Liu's avatar Changgang Liu Committed by Yas Naoi
Browse files

Issue #3158432 by liuchanggang, yas: Refactor assertions for message status...

Issue #3158432 by liuchanggang, yas: Refactor assertions for message status and HTTP response code in test cases (K8s) (1)
parent 07c4ac37
No related branches found
No related tags found
No related merge requests found
Showing
with 111 additions and 144 deletions
......@@ -35,7 +35,7 @@ class K8sApiServiceTest extends K8sTestBase {
// List API Service for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/api_service");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new API Service.
$add = $this->createApiServiceTestFormData(self::K8S_API_SERVICE_REPEAT_COUNT);
......@@ -50,22 +50,20 @@ class K8sApiServiceTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'API Service', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/api_service");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_API_SERVICE_REPEAT_COUNT; $i++, $num++) {
// Make sure the all api_service listing exists.
$this->drupalGet('/clouds/k8s/api_service');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -84,7 +82,7 @@ class K8sApiServiceTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'API Service', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
......@@ -100,13 +98,13 @@ class K8sApiServiceTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'API Service', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/api_service");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -36,7 +36,7 @@ class K8sClusterRoleBindingTest extends K8sTestBase {
// List Cluster Role Binding for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/cluster_role_binding");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Cluster Role Binding.
$add = $this->createClusterRoleBindingTestFormData(self::K8S_CLUSTER_ROLE_BINDING_REPEAT_COUNT);
......@@ -50,22 +50,20 @@ class K8sClusterRoleBindingTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Cluster Role Binding', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/cluster_role_binding");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_CLUSTER_ROLE_BINDING_REPEAT_COUNT; $i++, $num++) {
// Make sure the all cluster_role_binding listing exists.
$this->drupalGet('/clouds/k8s/cluster_role_binding');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -83,7 +81,7 @@ class K8sClusterRoleBindingTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Cluster Role Binding', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -98,13 +96,13 @@ class K8sClusterRoleBindingTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Cluster Role Binding', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/cluster_role_binding");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -36,7 +36,7 @@ class K8sClusterRoleTest extends K8sTestBase {
// List Cluster Role for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/cluster_role");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Cluster Role.
$add = $this->createClusterRoleTestFormData(self::K8S_CLUSTER_ROLE_REPEAT_COUNT);
......@@ -50,22 +50,20 @@ class K8sClusterRoleTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Cluster Role', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/cluster_role");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_CLUSTER_ROLE_REPEAT_COUNT; $i++, $num++) {
// Make sure the all cluster_role listing exists.
$this->drupalGet('/clouds/k8s/cluster_role');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -83,7 +81,7 @@ class K8sClusterRoleTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Cluster Role', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -98,13 +96,13 @@ class K8sClusterRoleTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Cluster Role', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/cluster_role");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -43,7 +43,7 @@ class K8sConfigMapTest extends K8sTestBase {
// List ConfigMap for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/config_map");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new ConfigMap.
$add = $this->createConfigMapTestFormData(self::K8S_CONFIG_MAP_REPEAT_COUNT, $this->namespace);
......@@ -57,22 +57,20 @@ class K8sConfigMapTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'ConfigMap', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/config_map");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_CONFIG_MAP_REPEAT_COUNT; $i++, $num++) {
// Make sure the all config_map listing exists.
$this->drupalGet('/clouds/k8s/config_map');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -91,7 +89,7 @@ class K8sConfigMapTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'ConfigMap', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -106,13 +104,13 @@ class K8sConfigMapTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'ConfigMap', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/config_map");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -44,7 +44,7 @@ class K8sCronJobTest extends K8sTestBase {
// List Cron Job for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/cron_job");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Cron Job.
$add = $this->createCronJobTestFormData(self::K8S_CRON_JOB_REPEAT_COUNT, $this->namespace);
......@@ -58,22 +58,20 @@ class K8sCronJobTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Cron Job', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/cron_job");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_CRON_JOB_REPEAT_COUNT; $i++, $num++) {
// Make sure the all cron_job listing exists.
$this->drupalGet('/clouds/k8s/cron_job');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -92,7 +90,7 @@ class K8sCronJobTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Cron Job', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -107,13 +105,13 @@ class K8sCronJobTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Cron Job', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/cron_job");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -43,7 +43,7 @@ class K8sDaemonSetTest extends K8sTestBase {
// List Daemon Set for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/daemon_set");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Daemon Set.
$add = $this->createDaemonSetTestFormData(self::K8S_DAEMON_SET_REPEAT_COUNT, $this->namespace);
......@@ -57,22 +57,20 @@ class K8sDaemonSetTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Daemon Set', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/daemon_set");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_DAEMON_SET_REPEAT_COUNT; $i++, $num++) {
// Make sure the all daemon_set listing exists.
$this->drupalGet('/clouds/k8s/daemon_set');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -91,7 +89,7 @@ class K8sDaemonSetTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Daemon Set', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -106,13 +104,13 @@ class K8sDaemonSetTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Daemon Set', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/daemon_set");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -44,7 +44,7 @@ class K8sDeploymentTest extends K8sTestBase {
// List Deployment for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/deployment");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Deployment.
$add = $this->createDeploymentTestFormData(self::K8S_DEPLOYMENT_REPEAT_COUNT, $this->namespace);
......@@ -58,22 +58,20 @@ class K8sDeploymentTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Deployment', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/deployment");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_DEPLOYMENT_REPEAT_COUNT; $i++, $num++) {
// Make sure the all deployment listing exists.
$this->drupalGet('/clouds/k8s/deployment');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -92,7 +90,7 @@ class K8sDeploymentTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Deployment', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -107,13 +105,13 @@ class K8sDeploymentTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Deployment', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/deployment");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -42,7 +42,7 @@ class K8sEndpointTest extends K8sTestBase {
// List endpoint for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/endpoint");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new endpoint.
$add = $this->createEndpointTestFormData(self::K8S_ENDPOINT_REPEAT_COUNT, $this->namespace);
......@@ -56,22 +56,20 @@ class K8sEndpointTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Endpoint', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/endpoint");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_ENDPOINT_REPEAT_COUNT; $i++, $num++) {
// Make sure the all endpoint listing exists.
$this->drupalGet('/clouds/k8s/endpoint');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -90,7 +88,7 @@ class K8sEndpointTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Endpoint', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -105,13 +103,13 @@ class K8sEndpointTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Endpoint', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/endpoint");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -34,7 +34,7 @@ class K8sEventTest extends K8sTestBase {
// Update k8s events.
$this->drupalGet("/clouds/k8s/$cloud_context/event/update");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
for ($i = 0; $i < self::K8S_EVENT_REPEAT_COUNT; $i++) {
$this->assertSession()->pageTextContains($data[$i]['name']);
......@@ -43,8 +43,7 @@ class K8sEventTest extends K8sTestBase {
for ($i = 0, $num = 1; $i < self::K8S_EVENT_REPEAT_COUNT; $i++, $num++) {
// Make sure the all event listing exists.
$this->drupalGet('/clouds/k8s/event');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($data[$j]['name']);
......
......@@ -43,7 +43,7 @@ class K8sIngressTest extends K8sTestBase {
// List Ingress for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/ingress");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Ingress.
$add = $this->createIngressTestFormData(self::K8S_INGRESS_REPEAT_COUNT, $this->namespace);
......@@ -57,22 +57,20 @@ class K8sIngressTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Ingress', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/ingress");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_INGRESS_REPEAT_COUNT; $i++, $num++) {
// Make sure the all ingress listing exists.
$this->drupalGet('/clouds/k8s/ingress');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -91,7 +89,7 @@ class K8sIngressTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Ingress', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -106,13 +104,13 @@ class K8sIngressTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Ingress', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/ingress");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -44,7 +44,7 @@ class K8sJobTest extends K8sTestBase {
// List Job for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/job");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Job.
$add = $this->createJobTestFormData(self::K8S_JOB_REPEAT_COUNT, $this->namespace);
......@@ -58,22 +58,20 @@ class K8sJobTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Job', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/job");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_JOB_REPEAT_COUNT; $i++, $num++) {
// Make sure the all job listing exists.
$this->drupalGet('/clouds/k8s/job');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -92,7 +90,7 @@ class K8sJobTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Job', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -107,13 +105,13 @@ class K8sJobTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Job', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/job");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -43,7 +43,7 @@ class K8sLimitRangeTest extends K8sTestBase {
// List Limit Range for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/limit_range");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Limit Range.
$add = $this->createLimitRangeTestFormData(self::K8S_LIMIT_RANGE_REPEAT_COUNT, $this->namespace);
......@@ -57,22 +57,20 @@ class K8sLimitRangeTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Limit Range', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/limit_range");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_LIMIT_RANGE_REPEAT_COUNT; $i++, $num++) {
// Make sure the all limit_range listing exists.
$this->drupalGet('/clouds/k8s/limit_range');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -91,7 +89,7 @@ class K8sLimitRangeTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Limit Range', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -106,13 +104,13 @@ class K8sLimitRangeTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Limit Range', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/limit_range");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -35,7 +35,7 @@ class K8sNamespaceTest extends K8sTestBase {
// List Namespace for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/namespace");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Namespace.
$add = $this->createNamespaceTestFormData(self::K8S_NAMESPACE_REPEAT_COUNT);
......@@ -49,22 +49,20 @@ class K8sNamespaceTest extends K8sTestBase {
$add[$i],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Namespace', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/namespace");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_NAMESPACE_REPEAT_COUNT; $i++, $num++) {
// Make sure the all namespace listing exists.
$this->drupalGet('/clouds/k8s/namespace');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -83,13 +81,13 @@ class K8sNamespaceTest extends K8sTestBase {
$edit[$i],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Namespace', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
// Make sure labels.
$this->drupalGet("/clouds/k8s/$cloud_context/namespace/$num");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($edit[$i]['labels[0][item_key]']);
$this->assertSession()->pageTextContains($edit[$i]['labels[0][item_value]']);
$this->assertSession()->pageTextContains($edit[$i]['annotations[0][item_key]']);
......@@ -102,20 +100,20 @@ class K8sNamespaceTest extends K8sTestBase {
$this->deleteNamespaceMockData($add[$i]);
$this->drupalGet("/clouds/k8s/$cloud_context/namespace/$num/delete");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->drupalPostForm(
"/clouds/k8s/$cloud_context/namespace/$num/delete",
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Namespace', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/namespace");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -43,7 +43,7 @@ class K8sNetworkPolicyTest extends K8sTestBase {
// List Network Policy for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/network_policy");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Network Policy.
$add = $this->createNetworkPolicyTestFormData(self::K8S_NETWORK_POLICY_REPEAT_COUNT, $this->namespace);
......@@ -57,22 +57,20 @@ class K8sNetworkPolicyTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Network Policy', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/network_policy");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_NETWORK_POLICY_REPEAT_COUNT; $i++, $num++) {
// Make sure the all network_policy listing exists.
$this->drupalGet('/clouds/k8s/network_policy');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -91,7 +89,7 @@ class K8sNetworkPolicyTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Network Policy', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -106,13 +104,13 @@ class K8sNetworkPolicyTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Network Policy', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/network_policy");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -34,7 +34,7 @@ class K8sNodeTest extends K8sTestBase {
// Update k8s nodes.
$this->drupalGet("/clouds/k8s/$cloud_context/node/update");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
for ($i = 0; $i < self::K8S_NODE_REPEAT_COUNT; $i++) {
$this->assertSession()->pageTextContains($data[$i]['name']);
......@@ -43,9 +43,7 @@ class K8sNodeTest extends K8sTestBase {
for ($i = 0, $num = 1; $i < self::K8S_NODE_REPEAT_COUNT; $i++, $num++) {
// Make sure the all node listing exists.
$this->drupalGet('/clouds/k8s/node');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($data[$j]['name']);
......
......@@ -42,7 +42,7 @@ class K8sPersistentVolumeClaimTest extends K8sTestBase {
// List Persistent Volume Claim for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/persistent_volume_claim");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new Persistent Volume Claim.
$add = $this->createPersistentVolumeClaimTestFormData(self::K8S_PERSISTENT_VOLUME_CLAIM_REPEAT_COUNT, $this->namespace);
......@@ -56,22 +56,20 @@ class K8sPersistentVolumeClaimTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Persistent Volume Claim', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/persistent_volume_claim");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_PERSISTENT_VOLUME_CLAIM_REPEAT_COUNT; $i++, $num++) {
// Make sure the all persistent_volume_claim listing exists.
$this->drupalGet('/clouds/k8s/persistent_volume_claim');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -90,7 +88,7 @@ class K8sPersistentVolumeClaimTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Persistent Volume Claim', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -105,13 +103,13 @@ class K8sPersistentVolumeClaimTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Persistent Volume Claim', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/persistent_volume_claim");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
......@@ -35,7 +35,7 @@ class K8sPersistentVolumeTest extends K8sTestBase {
// List persistent volume for K8s.
$this->drupalGet("/clouds/k8s/$cloud_context/persistent_volume");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
// Add a new persistent volume.
$add = $this->createPersistentVolumeTestFormData(self::K8S_PERSISTENT_VOLUME_REPEAT_COUNT);
......@@ -49,22 +49,20 @@ class K8sPersistentVolumeTest extends K8sTestBase {
$add[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Persistent Volume', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been created.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/persistent_volume");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextContains($add[$i]['name']);
}
for ($i = 0, $num = 1; $i < self::K8S_PERSISTENT_VOLUME_REPEAT_COUNT; $i++, $num++) {
// Make sure the all persistent_volume listing exists.
$this->drupalGet('/clouds/k8s/persistent_volume');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains($this->t('Notice'));
$this->assertSession()->pageTextNotContains($this->t('Warning'));
$this->assertNoErrorMessage();
for ($j = 0; $j < $num; $j++) {
$this->assertSession()->pageTextContains($add[$j]['name']);
......@@ -82,7 +80,7 @@ class K8sPersistentVolumeTest extends K8sTestBase {
$edit[$i]['post_data'],
$this->t('Save')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Persistent Volume', '%label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type %label has been updated.', $t_args)));
}
......@@ -97,13 +95,13 @@ class K8sPersistentVolumeTest extends K8sTestBase {
[],
$this->t('Delete')
);
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$t_args = ['@type' => 'Persistent Volume', '@label' => $add[$i]['name']];
$this->assertSession()->pageTextContains(strip_tags($this->t('The @type @label has been deleted.', $t_args)));
// Make sure listing.
$this->drupalGet("/clouds/k8s/$cloud_context/persistent_volume");
$this->assertSession()->statusCodeEquals(200);
$this->assertNoErrorMessage();
$this->assertSession()->pageTextNotContains($add[$i]['name']);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment