<commit_before>// Copyright 2019 Authors of Cilium
//
// 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 k8sTest

import (
	"context"
	"fmt"
	"net"

	. "github.com/cilium/cilium/test/ginkgo-ext"
	"github.com/cilium/cilium/test/helpers"

	. "github.com/onsi/gomega"
)

var _ = Describe("K8sFQDNTest", func() {
	var (
		kubectl          *helpers.Kubectl
		backgroundCancel context.CancelFunc = func() {}
		backgroundError  error

		demoManifest   = ""
		ciliumFilename string

		apps    = []string{helpers.App2, helpers.App3}
		appPods map[string]string

		// The IPs are updated in BeforeAll
		worldTarget          = "http://vagrant-cache.ci.cilium.io"
		worldTargetIP        = "192.168.127.12"
		worldInvalidTarget   = "http://jenkins.cilium.io"
		worldInvalidTargetIP = "192.168.3.11"
	)

	BeforeAll(func() {
		// In case the IPs changed from above, update them here
		var lookupErr error
		err := helpers.WithTimeout(func() bool {
			var addrs []string
			addrs, lookupErr = net.LookupHost("vagrant-cache.ci.cilium.io")
			if lookupErr != nil {
				lookupErr = fmt.Errorf("error looking up vagrant-cache.ci.cilium.io: %s", lookupErr)
				return false
			}
			worldTargetIP = addrs[0]

			addrs, lookupErr = net.LookupHost("jenkins.cilium.io")
			if lookupErr != nil {
				lookupErr = fmt.Errorf("error looking up jenkins.cilium.io: %s", lookupErr)
				return false
			}
			worldInvalidTargetIP = addrs[0]

			return true
		}, "Could not get vagrant-cache.ci.cilium.io and jenkins.cilium.io IPs", &helpers.TimeoutConfig{Timeout: helpers.MidCommandTimeout})
		Expect(err).Should(BeNil(), "Error obtaining IPs for test: %s", lookupErr)
<commit_msg>test: Use longer timeout for ginkgo DNS lookups<commit_after>// Copyright 2019 Authors of Cilium
//
// 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 k8sTest

import (
	"context"
	"fmt"
	"net"

	. "github.com/cilium/cilium/test/ginkgo-ext"
	"github.com/cilium/cilium/test/helpers"

	. "github.com/onsi/gomega"
)

var _ = Describe("K8sFQDNTest", func() {
	var (
		kubectl          *helpers.Kubectl
		backgroundCancel context.CancelFunc = func() {}
		backgroundError  error

		demoManifest   = ""
		ciliumFilename string

		apps    = []string{helpers.App2, helpers.App3}
		appPods map[string]string

		// The IPs are updated in BeforeAll
		worldTarget          = "http://vagrant-cache.ci.cilium.io"
		worldTargetIP        = "192.168.127.12"
		worldInvalidTarget   = "http://jenkins.cilium.io"
		worldInvalidTargetIP = "192.168.3.11"
	)

	BeforeAll(func() {
		// In case the IPs changed from above, update them here
		var lookupErr error
		err := helpers.WithTimeout(func() bool {
			addrs, err2 := net.LookupHost("vagrant-cache.ci.cilium.io")
			if err2 != nil {
				lookupErr = fmt.Errorf("error looking up vagrant-cache.ci.cilium.io: %s", err2)
				return false
			}
			worldTargetIP = addrs[0]
			return true
		}, "Could not get vagrant-cache.ci.cilium.io IP", &helpers.TimeoutConfig{Timeout: helpers.HelperTimeout})
		Expect(err).Should(BeNil(), "Error obtaining IP for test: %s", lookupErr)

		lookupErr = nil
		err = helpers.WithTimeout(func() bool {
			addrs, err2 := net.LookupHost("jenkins.cilium.io")
			if err2 != nil {
				lookupErr = fmt.Errorf("error looking up jenkins.cilium.io: %s", err2)
				return false
			}
			worldInvalidTargetIP = addrs[0]
			return true
		}, "Could not get jenkins.cilium.io IP", &helpers.TimeoutConfig{Timeout: helpers.HelperTimeout})
		Expect(err).Should(BeNil(), "Error obtaining IP for test: %s", lookupErr)

{'fraction_non_alphanumeric': 0.11823204419889503, 'fraction_numerical': 0.016353591160220993, 'mean_word_length': 3.454724409448819, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 4, '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': '7203186', 'n_tokens_mistral': 1609, 'n_tokens_neox': 1468, 'n_words': 422}