cloudenv_test.go 725 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (c) Tailscale Inc & contributors
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. package cloudenv
  4. import (
  5. "flag"
  6. "net/netip"
  7. "testing"
  8. )
  9. var extNetwork = flag.Bool("use-external-network", false, "use the external network in tests")
  10. // Informational only since we can run tests in a variety of places.
  11. func TestGetCloud(t *testing.T) {
  12. if !*extNetwork {
  13. t.Skip("skipping test without --use-external-network")
  14. }
  15. cloud := getCloud()
  16. t.Logf("Cloud: %q", cloud)
  17. t.Logf("Cloud.HasInternalTLD: %v", cloud.HasInternalTLD())
  18. t.Logf("Cloud.ResolverIP: %q", cloud.ResolverIP())
  19. }
  20. func TestGetDigitalOceanResolver(t *testing.T) {
  21. addr := netip.MustParseAddr(getDigitalOceanResolver())
  22. t.Logf("got: %v", addr)
  23. }