<commit_before>package notifier

import (
	"github.com/stretchr/testify/assert"
	"net/http"
	"net/http/httptest"
	"testing"
)

func TestSlackNotificationForTerminationStatusOk(t *testing.T) {
	webhookPath := <KEY>"

	testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
		assert.Equal(t, req.URL.Path, webhookPath)
		res.WriteHeader(200)
		res.Write([]byte("ok"))
	}))

	defer testServer.Close()

	slack := NewSlackNotifier(testServer.URL + webhookPath)
	err := slack.NotifyTermination(Termination{
		Pod:       "chaos-57df4db6b-h9ktj",
		Namespace: "chaos",<commit_msg>handled error on http write in slack_test.go<commit_after>package notifier

import (
	"github.com/stretchr/testify/assert"
	"net/http"
	"net/http/httptest"
	"testing"
)

func TestSlackNotificationForTerminationStatusOk(t *testing.T) {
	webhookPath := <KEY>"

	testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
		assert.Equal(t, req.URL.Path, webhookPath)
		res.WriteHeader(200)
		if _, err := res.Write([]byte("ok")); err != nil {
			t.Fatal(err)
		}
	}))

	defer testServer.Close()

	slack := NewSlackNotifier(testServer.URL + webhookPath)
	err := slack.NotifyTermination(Termination{
		Pod:       "chaos-57df4db6b-h9ktj",
		Namespace: "chaos",
{'fraction_non_alphanumeric': 0.1445966514459665, 'fraction_numerical': 0.0121765601217656, 'mean_word_length': 5.144859813084112, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '199979', 'n_tokens_mistral': 512, 'n_tokens_neox': 484, 'n_words': 76}