<commit_before>// Copyright 2016 ePoxy Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//////////////////////////////////////////////////////////////////////////////

package storage

import (
	"log"
	"testing"
	"time"
)

func TestHostString(t *testing.T) {
	hostExpected := `{
    "Name": "mlab1.iad1t.measurement-lab.org",
    "IPv4Addr": "172.16.58.3",
    "Boot": {
        "Stage1ChainURL": "https://storage.googleapis.com/epoxy-boot-server/coreos/stage1to2.ipxe",
        "Stage2ChainURL": "https://storage.googleapis.com/epoxy-boot-server/coreos/stage2to3.json",
        "Stage3ChainURL": "https://storage.googleapis.com/epoxy-boot-server/coreos/stage3setup.json"
    },
    "Update": {
        "Stage1ChainURL": "https://storage.googleapis.com/epoxy-boot-server/centos6/install.json",
        "Stage2ChainURL": "https://storage.googleapis.com/epoxy-boot-server/centos6/boot.json",
        "Stage3ChainURL": ""
    },
    "UpdateEnabled": false,
    "Extensions": null,
    "CurrentSessionIDs": {
        "Stage2ID": "01234",
        "Stage3ID": "56789",
        "ReportID": "13579",
        "ExtensionID": ""
    },
    "LastSessionCreation": "2016-01-02T15:04:00Z",
    "LastReport": "0001-01-01T00:00:00Z",
    "LastSuccess": "0001-01-01T00:00:00Z",
    "CollectedInformation": {
        "asset": "12345",
        "chip": "",
        "ip": "192.168.0.2",
        "mac": "12:34:56:78:90:ab",
        "manufacturer": "dell",
        "platform": "i386",
        "product": "",
        "serial": "abcdefg",
        "uuid": "abcd-efgh-ijkl",
        "version": "3.4.1234"
    }
}`
	lastCreated, err := time.Parse("Jan 2, 2006 at 3:04pm (GMT)", "Jan 2, 2016 at 3:04pm (GMT)")
	if err != nil {
		t.Fatal(err)
	}
	h := Host{
		Name:     "mlab1.iad1t.measurement-lab.org",
		IPv4Addr: "172.16.58.3",
		Boot: Sequence{
			Stage1ChainURL: "https://storage.googleapis.com/epoxy-boot-server/coreos/stage1to2.ipxe",
			Stage2ChainURL: "https://storage.googleapis.com/epoxy-boot-server/coreos/stage2to3.json",
			Stage3ChainURL: "https://storage.googleapis.com/epoxy-boot-server/coreos/stage3setup.json",
		},
		Update: Sequence{
			Stage1ChainURL: "https://storage.googleapis.com/epoxy-boot-server/centos6/install.json",
			Stage2ChainURL: "https://storage.googleapis.com/epoxy-boot-server/centos6/boot.json",
			Stage3ChainURL: "",
		},
		CurrentSessionIDs: SessionIDs{
			Stage2ID: "01234",
			Stage3ID: "56789",
			ReportID: "13579",
		},
		LastSessionCreation: lastCreated,
		CollectedInformation: map[string]string{
			"platform":     "i386",
			"serial":       "abcdefg",
			"asset":        "12345",
			"uuid":         "abcd-efgh-ijkl",
			"manufacturer": "dell",
			"product":      "",
			"chip":         "",
			"mac":          "12:34:56:78:90:ab",
			"ip":           "192.168.0.2",
			"version":      "3.4.1234",
		},<commit_msg>Update examples with real values<commit_after>// Copyright 2016 ePoxy Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//////////////////////////////////////////////////////////////////////////////

package storage

import (
	"log"
	"testing"
	"time"
)

func TestHostString(t *testing.T) {
	hostExpected := `{
    "Name": "mlab1.iad1t.measurement-lab.org",
    "IPv4Addr": "172.16.58.3",
    "Boot": {
        "Stage1ChainURL": "https://storage.googleapis.com/epoxy-boot-server/coreos/stage1to2.ipxe",
        "Stage2ChainURL": "https://storage.googleapis.com/epoxy-boot-server/coreos/stage2to3.json",
        "Stage3ChainURL": "https://storage.googleapis.com/epoxy-boot-server/coreos/stage3setup.json"
    },
    "Update": {
        "Stage1ChainURL": "https://storage.googleapis.com/epoxy-boot-server/centos6/install.json",
        "Stage2ChainURL": "https://storage.googleapis.com/epoxy-boot-server/centos6/boot.json",
        "Stage3ChainURL": ""
    },
    "UpdateEnabled": false,
    "Extensions": null,
    "CurrentSessionIDs": {
        "Stage2ID": "01234",
        "Stage3ID": "56789",
        "ReportID": "13579",
        "ExtensionID": ""
    },
    "LastSessionCreation": "2016-01-02T15:04:00Z",
    "LastReport": "0001-01-01T00:00:00Z",
    "LastSuccess": "0001-01-01T00:00:00Z",
    "CollectedInformation": {
        "buildarch": "i386",
        "chip": "ConnectX-3",
        "ip": "192.168.0.2",
        "mac": "12:34:56:78:90:ab",
        "platform": "pcbios",
        "product": "",
        "serial": "abcdefg",
        "uuid": "abcd-efgh-ijkl",
        "version": "3.4.1234"
    }
}`
	lastCreated, err := time.Parse("Jan 2, 2006 at 3:04pm (GMT)", "Jan 2, 2016 at 3:04pm (GMT)")
	if err != nil {
		t.Fatal(err)
	}
	h := Host{
		Name:     "mlab1.iad1t.measurement-lab.org",
		IPv4Addr: "172.16.58.3",
		Boot: Sequence{
			Stage1ChainURL: "https://storage.googleapis.com/epoxy-boot-server/coreos/stage1to2.ipxe",
			Stage2ChainURL: "https://storage.googleapis.com/epoxy-boot-server/coreos/stage2to3.json",
			Stage3ChainURL: "https://storage.googleapis.com/epoxy-boot-server/coreos/stage3setup.json",
		},
		Update: Sequence{
			Stage1ChainURL: "https://storage.googleapis.com/epoxy-boot-server/centos6/install.json",
			Stage2ChainURL: "https://storage.googleapis.com/epoxy-boot-server/centos6/boot.json",
			Stage3ChainURL: "",
		},
		CurrentSessionIDs: SessionIDs{
			Stage2ID: "01234",
			Stage3ID: "56789",
			ReportID: "13579",
		},
		LastSessionCreation: lastCreated,
		CollectedInformation: map[string]string{
			"platform":  "pcbios",
			"buildarch": "i386",
			"serial":    "abcdefg",
			"uuid":      "abcd-efgh-ijkl",
			"product":   "",
			"chip":      "ConnectX-3",
			"mac":       "12:34:56:78:90:ab",
			"ip":        "192.168.0.2",
			"version":   "3.4.1234",
		},
{'fraction_non_alphanumeric': 0.19066206275334033, 'fraction_numerical': 0.062453085122354, 'mean_word_length': 2.8133943903835146, 'pattern_counts': {'":': 80, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 20, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 8, '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': '1737746', 'n_tokens_mistral': 2614, 'n_tokens_neox': 2290, 'n_words': 434}