Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate sig_failover_acceptance to bazel #3550

Merged
merged 14 commits into from
Dec 27, 2019
Merged

Migrate sig_failover_acceptance to bazel #3550

merged 14 commits into from
Dec 27, 2019

Conversation

scrye
Copy link
Contributor

@scrye scrye commented Dec 20, 2019

Also:

  • add support for plugging a configurable fake SCIOND into the SIG; this
    makes it possible to run SIG tests without a control-plane
  • change the entrypoint of docker debug images from su-exec; it is not needed
    in debugging/development environments
  • change UDP proxy command line options; the new proxy uses
    deterministic ports when forwarding data
  • add config option AllowRunAsRoot to allow running the SIG and Go
    dispatcher as root
  • use ping instead of using go/acceptance/sig_ping_acceptance for
    connectivity tests
  • use static docker-compose file instead of topology generator
    to set up sig_failover_acceptance; the generator builds more
    files than necessary for the test, and also does not have
    support for fake sciond data; doing it directly from hand crafted
    files is easier to inspect, modify and debug;
  • remove BS, CS, PS, SD, BRs from sig_failover_acceptance

Fixes #3125.


This change is Reviewable

@scrye scrye requested a review from lukedirtwalker December 20, 2019 09:24
@scrye scrye self-assigned this Dec 20, 2019
Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 10 files at r2, 1 of 1 files at r3.
Reviewable status: 1 of 29 files reviewed, 4 unresolved discussions (waiting on @lukedirtwalker and @scrye)


.buildkite/pipeline_buildlint.yml, line 57 at r2 (raw file):

        - exit_status: 255 # Forced agent shutdown
  - label: "Acceptance: sig_failover"
    command: bazel test //acceptance/sig_failover:sig_failover_test

I think you need to create the accept_artifacts folder first:
- "mkdir -p $ACCEPTANCE_ARTIFACTS"


acceptance/sig_failover/docker-compose.yml, line 18 at r1 (raw file):

services:
  patha:
    command: ["-lx", "242.254.100.3:50000", "-rx", "242.254.100.2:30041", "-ly", "242.254.200.3:50000", "-ry", "242.254.200.2:30041"]

lx and rx are a bit short for my taste, what do they mean?


acceptance/sig_failover/docker-compose.yml, line 61 at r1 (raw file):

    image: bazel/acceptance/sig_failover_acceptance:sig1
    network_mode: service:dispatcher1
    privileged: true

why is that needed?


acceptance/sig_failover/test, line 60 at r1 (raw file):

run_test() {(set -e

    bash "$(rlocation __main__/go/tools/udpproxy/udpproxy)" --norun

add a comment what this block does. I guess it loads all the required docker images, but this is far from obvious ;)

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 21 of 32 files at r1, 1 of 10 files at r2.
Reviewable status: 22 of 29 files reviewed, 7 unresolved discussions (waiting on @lukedirtwalker and @scrye)


go/lib/sciond/fake/fake.go, line 61 at r2 (raw file):

type Path struct {
	JSONFingerprint string   `json:"Fingerprint"`

Usually we use snake_case for JSON. IDC this much here.


go/lib/sciond/fake/testdata/sd.json, line 14 at r2 (raw file):

      }
    ]
  }

add newline


go/sig/egress/reader/reader.go, line 81 at r2 (raw file):

			buf = buf[:length]
			dstIP, err := r.getDestIP(buf)
			log.Debug("XXX", "read", buf[:length], "to", dstIP)

remove?


go/sig/egress/session/sessmon.go, line 137 at r2 (raw file):

			"newExpiration", currPath.Path().Expiry(),
			"oldMTU", mtu,
			"newMTU", currPath.Path().MTU)

💯

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 10 files at r2, 3 of 4 files at r4.
Reviewable status: 25 of 29 files reviewed, 10 unresolved discussions (waiting on @scrye)


acceptance/sig_failover/BUILD.bazel, line 7 at r4 (raw file):

    size = "small",
    srcs = ["test"],
    args = ["setup"],

Is that still needed?


acceptance/sig_failover/BUILD.bazel, line 13 at r4 (raw file):

    data = [
        "//go/tools/udpproxy:udpproxy",
        "//acceptance/sig_failover:dispatcher1",

Nit: I think for deps in the same file usually the shorter form like ":dispacher1" is used


acceptance/sig_failover/BUILD.bazel, line 18 at r4 (raw file):

        "//acceptance/sig_failover:sig2",
        "docker-compose.yml",
    ] + glob(["testdata/**/*"]),

testdata is already included by the containers, so no longer needed here I think.


acceptance/sig_failover/test, line 101 at r4 (raw file):

mkdir -p $ACCEPTANCE_ARTIFACTS

echo "ls -la $ACCEPTANCE_ARTIFACTS"

Clean up?


acceptance/sig_failover/test, line 117 at r4 (raw file):

docker-compose -f acceptance/sig_failover/docker-compose.yml down

find $ACCEPTANCE_ARTIFACTS

Remove?

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 32 files at r1, 1 of 4 files at r4.
Reviewable status: 27 of 29 files reviewed, 13 unresolved discussions (waiting on @scrye)


acceptance/sig_failover/docker-compose.yml, line 12 at r4 (raw file):

    driver: bridge
    driver_opts:
      com.docker.network.bridge.name: bridge2

for what is that needed?


go/lib/sciond/fake/fake.go, line 3 at r4 (raw file):

// Copyright 2019 Anapaya Systems

package fake

I wonder about the naming. This is also kind of a mock? But maybe mock is already overloaded, so not sure.


go/lib/sciond/fake/fake.go, line 204 at r4 (raw file):

func (c connector) Close(ctx context.Context) error {
	panic("not implemented")

this could also just be return nil

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 10 files at r2.
Reviewable status: all files reviewed, 15 unresolved discussions (waiting on @scrye)


go/lib/sciond/fake/fake.go, line 149 at r4 (raw file):

	currentTime := time.Now()
	secondsElapsed := int(currentTime.Sub(c.creationTime).Seconds())

time.Since would be slightly nicer


go/lib/sciond/fake/fake_test.go, line 115 at r4 (raw file):

	assert.True(t, paths[0].Expiry().After(time.Now().Add(time.Hour)))

	time.Sleep(time.Second)

I don't like that. But except from adding a custom clock into the provider I don't see a way around it. So I guess we can leave it for now.

Also:
- add support for plugging a configurable fake SCIOND into the SIG; this
makes it possible to run SIG tests without a control-plane
- change the entrypoint of docker debug images from su-exec; it is not needed
in debugging/development environments
- change UDP proxy command line options; the new proxy uses
deterministic ports when forwarding data
- add config option AllowRunAsRoot to allow running the SIG and Go
dispatcher as root
- use ping instead of using go/acceptance/sig_ping_acceptance for
connectivity tests
- use static docker-compose file instead of topology generator
to set up sig_failover_acceptance; the generator builds more
files than necessary for the test, and also does not have
support for fake sciond data; doing it directly from hand crafted
files is easier to inspect, modify and debug;
- remove BS, CS, PS, SD, BRs from sig_failover_acceptance

Fixes #3125.
Copy link
Contributor Author

@scrye scrye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 17 of 28 files reviewed, 14 unresolved discussions (waiting on @lukedirtwalker and @scrye)


acceptance/sig_failover/BUILD.bazel, line 7 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Is that still needed?

Done.


acceptance/sig_failover/BUILD.bazel, line 18 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

testdata is already included by the containers, so no longer needed here I think.

Done.


acceptance/sig_failover/docker-compose.yml, line 18 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

lx and rx are a bit short for my taste, what do they mean?

Done.


acceptance/sig_failover/docker-compose.yml, line 61 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

why is that needed?

Needed for doing the tun operations in docker.


acceptance/sig_failover/docker-compose.yml, line 12 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

for what is that needed?

Custom interface name for the Linux bridge to be created. It's copy pasted from what the generator was outputting, so I don't know if it's really required.


acceptance/sig_failover/test, line 60 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

add a comment what this block does. I guess it loads all the required docker images, but this is far from obvious ;)

Done.


acceptance/sig_failover/test, line 101 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Clean up?

Not done yet. I'll clean this file up at the end after we have the logs correctly exported.


acceptance/sig_failover/test, line 117 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Remove?

Same as above.


go/lib/sciond/fake/fake.go, line 61 at r2 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Usually we use snake_case for JSON. IDC this much here.

Ah, then we must use snake_case everywhere. I think there's even an issue open I ran into on Monday, #2923.

Done.


go/lib/sciond/fake/fake.go, line 3 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

I wonder about the naming. This is also kind of a mock? But maybe mock is already overloaded, so not sure.

Yeah, not sure either. https://stackoverflow.com/questions/346372/whats-the-difference-between-faking-mocking-and-stubbing provides some opinions, so I guess anything works for this specific case.


go/lib/sciond/fake/fake.go, line 149 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

time.Since would be slightly nicer

Done.


go/lib/sciond/fake/fake.go, line 204 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

this could also just be return nil

Done.


go/lib/sciond/fake/fake_test.go, line 115 at r4 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

I don't like that. But except from adding a custom clock into the provider I don't see a way around it. So I guess we can leave it for now.

Yeah, fixing most of our timing-based unit tests via custom clocks would be a nice future clean-up task.


go/lib/sciond/fake/testdata/sd.json, line 14 at r2 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

add newline

Done.


go/sig/egress/reader/reader.go, line 81 at r2 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

remove?

Done.

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 12 of 16 files at r5.
Reviewable status: 27 of 29 files reviewed, 2 unresolved discussions (waiting on @lukedirtwalker and @scrye)

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r6.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @lukedirtwalker)

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r7.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@scrye scrye merged commit aba89e7 into scionproto:master Dec 27, 2019
@scrye scrye deleted the pubpr-fake-sciond branch December 27, 2019 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sig_failover test: Reply caching on startup of test topology is problematic
2 participants