Skip to content

Pilot unit and integration test fixes#19790

Merged
istio-testing merged 23 commits intoistio:masterfrom
seflerZ:integration-unit-test-fixes
Dec 26, 2019
Merged

Pilot unit and integration test fixes#19790
istio-testing merged 23 commits intoistio:masterfrom
seflerZ:integration-unit-test-fixes

Conversation

@seflerZ
Copy link
Copy Markdown
Contributor

@seflerZ seflerZ commented Dec 25, 2019

This PR resolves two issues in Pilot component:
✔ Fixed the corrupted docker building and unit testing process.(Moved here)
✔ Fixed some tests not fully applied to namespace isolation in integration tests.

I'll explain those in details:
📃 The Istio integration test framework supports namespace customizing while deploying Istio despite the default "istio-system". But not all tests obeyed this instruction and even some of the configurations were hard coded in source. I fixed them up and tested.

⚠ Other Istio components may also have the same issues and need fix up but I focused on Pilot only this time.

@istio-testing istio-testing added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test labels Dec 25, 2019
@istio-testing
Copy link
Copy Markdown
Collaborator

Hi @seflerZ. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Dec 25, 2019
Makefile Outdated
endif

RUN = $(CONTAINER_CLI) run -t -i --sig-proxy=true -u $(UID):$(GID) --rm \
RUN = $(CONTAINER_CLI) run --sig-proxy=true -u $(UID):$(GID) --rm \
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is no need to start the container in interactive and terminal mode because this is a automation process. And it will cause some trouble if the caller process didn't get assigned to a tty, so I just removed them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think there are commands that run in a shell? I think there's a make shell that drops you into a shell in the docker container. Maybe there is a way to automatically detect this?

Copy link
Copy Markdown
Contributor Author

@seflerZ seflerZ Dec 26, 2019

Choose a reason for hiding this comment

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

I didn't find the "make shell" command and if I execute "make shell" in Istio src root. I got "make: *** No rule to make target 'shell'. Stop." error.

The "-t -i" options are used for user inputting from TTY. This is a automation process, no inputs needed from user. Removing this option doesn't affect shell script executing within docker container.

In some cases, if the caller doesn't get assigned to a shell (for example, a process started the building process), it will fail with error "input device is not a TTY". Therefore, I think it's better to remove this option.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Its in another repo, there is a pr out to add the Target to all repos. I don't think there is any reason we need to limit this to not user input

Copy link
Copy Markdown
Contributor Author

@seflerZ seflerZ Dec 26, 2019

Choose a reason for hiding this comment

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

Okay, this patch can be ignored. I'll remove it later.


server := createAndStartServer(liveServerStats)
defer server.Close()
probe := Probe{LocalHostAddr: "localhost", AdminPort: 1234}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Request HTTP without host is not allowed in HTTP1.1. I added them in some test cases, but encountered more empty host requests in test cases with updates from master branch. So I wrote a check in 'stats.go'(in the next diff window) and removed the redundant configurations.

@seflerZ
Copy link
Copy Markdown
Contributor Author

seflerZ commented Dec 25, 2019

@howardjohn Would you please take a look?

@hzxuzhonghu
Copy link
Copy Markdown
Member

/ok-to-test

Just one question: Isn't this run in the current CI? Why doesn't it fail?

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels Dec 26, 2019
@seflerZ
Copy link
Copy Markdown
Contributor Author

seflerZ commented Dec 26, 2019

/ok-to-test

Just one question: Isn't this run in the current CI? Why doesn't it fail?

The Istio CI runs tests and CI in local building tool chain, not docker and applied the default namespace "istio-system", so we wouldn't encounter those issues.

Copy link
Copy Markdown
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

test changes lgtm

Makefile Outdated
endif

RUN = $(CONTAINER_CLI) run -t -i --sig-proxy=true -u $(UID):$(GID) --rm \
RUN = $(CONTAINER_CLI) run --sig-proxy=true -u $(UID):$(GID) --rm \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think there are commands that run in a shell? I think there's a make shell that drops you into a shell in the docker container. Maybe there is a way to automatically detect this?

Makefile Outdated
--mount type=volume,source=gocache,destination="/gocache" \
$(CONDITIONAL_HOST_MOUNTS) \
-w /work $(IMG)
-w /work/src/istio.io/istio $(IMG)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a couple notes on this

This file comes from the common-files repo so it shouldn't be modified there.

Moving the src to a path like this seems pretty reasonable, especially if we start mounting other local repos so you can reference them with ../api for example. Would like @sdake opinion here as well.
Note that the build tools support for this repo was merged in a few days ago only and is off by default due to a few minor issues like this one. If we don't decide to change the folder structure like this I have a patch locally I was working on that fixes the same problem

Copy link
Copy Markdown
Contributor Author

@seflerZ seflerZ Dec 26, 2019

Choose a reason for hiding this comment

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

Thanks @howardjohn. If we don't change the path, run unit tests through "make pilot-test" command will fall directly with env BUILD_WITH_CONTAINER=1.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I understand, but there are other options to fix this as well. We should make sure this won't have other negative impact

Copy link
Copy Markdown
Contributor Author

@seflerZ seflerZ Dec 26, 2019

Choose a reason for hiding this comment

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

Okay, what's the next step? Wait for review from @sdake ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, but it will need to be in the common-files repo. If we remove this part from the pr I'll approve all the other changes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

but yes I think we should get Steve to look at this, he put a lot of work into getting this working across all the repos and I am not familiar with why all of it works the way it does

Copy link
Copy Markdown
Contributor Author

@seflerZ seflerZ Dec 26, 2019

Choose a reason for hiding this comment

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

Okay, Thanks. I'll remove this and leave it there.

@seflerZ seflerZ requested a review from howardjohn December 26, 2019 08:54
Copy link
Copy Markdown
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

thanks!

Makefile Outdated
$(DOCKER_SOCKET_MOUNT) \
$(CONTAINER_OPTIONS) \
--mount type=bind,source="$(PWD)",destination="/work" \
--mount type=bind,source="$(GOPATH)",destination="/work" \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what's the motivation for this? I think gopath is optional now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh nevermind we are mouning the entire gopath rather than just the working directory.

Makefile Outdated
--mount type=volume,source=gocache,destination="/gocache" \
$(CONDITIONAL_HOST_MOUNTS) \
-w /work $(IMG)
-w /work/src/istio.io/istio $(IMG)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

but yes I think we should get Steve to look at this, he put a lot of work into getting this working across all the repos and I am not familiar with why all of it works the way it does

@istio-testing istio-testing merged commit f0218ef into istio:master Dec 26, 2019
@seflerZ seflerZ deleted the integration-unit-test-fixes branch December 27, 2019 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants