<commit_before>package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"testing"
	"time"
)

// Should serve a known static error page if all backend servers are down
// and object isn't in cache/stale.
// NB: ideally this should be a page that we control that has a mechanism
//     to alert us that it has been served.
func TestFailoverErrorPageAllServersDown(t *testing.T) {
	t.Error("Not implemented")
}<commit_msg>Add "All backends are down" test<commit_after>package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"testing"
	"time"
)

// Should serve a known static error page if all backend servers are down
// and object isn't in cache/stale.
// NB: ideally this should be a page that we control that has a mechanism
//     to alert us that it has been served.
func TestFailoverErrorPageAllServersDown(t *testing.T) {

	originServer.Stop()
	backupServer1.Stop()
	backupServer2.Stop()

	sourceUrl := fmt.Sprintf("https://%s/?cache-bust=%s", *edgeHost, NewUUID())
	req, err := http.NewRequest("GET", sourceUrl, nil)
	if err != nil {
		t.Fatal(err)
	}
	resp, err := client.RoundTrip(req)
	if err != nil {
		t.Fatal(err)
	}

	if resp.StatusCode != 503 {
		t.Errorf("Invalid StatusCode received. Expected 503, got %d", resp.StatusCode)
	}

	err = StartBackendsInOrder(*edgeHost)
	if err != nil {
		// Bomb out - we do not have a consistent backend, so subsequent tests
		// would fail in unexpected ways.
		log.Fatal(err)
	}

}
{'fraction_non_alphanumeric': 0.12108559498956159, 'fraction_numerical': 0.0055671537926235215, 'mean_word_length': 3.6537216828478964, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4078406', 'n_tokens_mistral': 511, 'n_tokens_neox': 486, 'n_words': 167}