1
// Copyright 2019-2021 The Inspektor Gadget authors
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
7
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
21
func TestParsing(t *testing.T) {
22
word10 := []byte{9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}
23
output10 := "abcdefghi."
26
for i := 0; i < 25; i++ {
27
word250 = append(word250, word10...)
38
7, 'k', 'i', 'n', 'v', 'o', 'l', 'k',
41
// trailing garbage is ignored
44
output: "www.kinvolk.io.",
54
input: append(word250,
59
output: output250 + "zzz.",
63
for _, entry := range table {
64
output := parseLabelSequence(entry.input)
65
if output != entry.output {
66
t.Fatalf("Failed to parse DNS string: got %q, expected %q", output, entry.output)