-
Notifications
You must be signed in to change notification settings - Fork 346
adding web testing projects #120
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
Conversation
Done. @MichaelSimons this PR contains all test projects. I have verified each DockerFile and made sure that they work properly. |
@HongGit - Can you summarize the next steps? I am assuming it is to implement some automation. |
@HongGit -- you might add a checklist of what you have left to do like I have here: dotnet/dotnet-docker#438 |
@MichaelSimons and @richlander I am done integrating web testing projects into the main project. Feel free to let me know if anything is missing. |
@MichaelSimons it seems that 4.6.2 Build directory is missing in the build branch, is that by design? In addition, please let me know once you have 4.7.2 added, I will add the corrsponding web projects as well. |
@HongGit - I updated the aspnet-build branch with the latest changes from master. There is no 4.6.2 or 4.7 sdk images. 4.7.2 is the preferred sdk to use to build these projects. |
|
||
[Theory] | ||
[MemberData(nameof(GetVerifyImagesData))] | ||
public void VerifyImagesWithWebApps(ImageDescriptor imageDescriptor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be a lot of duplication with the other test case. Consider refactoring to encapsulate the commonality in a single location.
|
||
RUN msbuild SimpleWebApplication.csproj /verbosity:quiet /p:Configuration=Release | ||
|
||
ENTRYPOINT dir ./bin/SimpleWebApplication.dll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ENTRYPOINT doesn't seem like a real usage scenario. If you want to capture this, it seems like it would be better done with a docker run
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to make sure that that build was successful. What do you think about using CMD instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the more canonical way to do this would be do use docker run
after you built your Dockerfile - docker run dir ./bin/SimpleWebApplication.dll
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to make sure that that build was successful.
How is this being verified? I'm not seeing any automation that verifies the build was successful other than the Dockerfile built without error. Perhaps that is adequate, I am trying to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test just verifies that msbuild with no problems. Since no IIS is installed, it's not possible to verify web sites.
I don't see how "docker run" is different from using CMD or ENTRYPOINT. I reverted to my original approach, which is using dir, which verifies right after msbuild.
Please check out my new PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how "docker run" is different from using CMD or ENTRYPOINT. I reverted to my original approach, which is using dir, which verifies right after msbuild.
The responsibility of the Dockerfile in a scenario like this is to build the application. Setting the ENTRYPOINT to list the contents on a directory doesn't make sense and makes the resulting image more difficult to use for anything else as you would need to override the ENTRYPOINT.
Where is the new PR? I am not finding it? Why not just update this PR?
WORKDIR /app | ||
COPY . ./ | ||
|
||
RUN msbuild SimpleWebApplication.csproj /verbosity:quiet /p:Configuration=Release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the /verbosity:quiet
make it difficult to diagnose build failures?
|
||
RUN msbuild SimpleWebApplication.csproj /p:Configuration=Release | ||
|
||
RUN dir ./bin/SimpleWebApplication.dll No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per our discussion, I think the verification (e.g. dir ./bin/SimpleWebApplication.dll
) logic best belongs in the test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave this more thoughts. CMD is probably the most appropriate, which is executed during "docker run", that will be the test case you are referring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why it would be most appropriate for the CMD to be dir ./bin/SimpleWebApplication.dll
. Please explain. This doesn't seem like a normal usage. I would prefer the Dockerfile to be a typical usage we expect to see. All verification logic should reside within the tests. Please fix so that we can merge this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using CMD, the existence of the dll after build is being verified at docker run time. The verification logic is in the testcase, reside within the tests. Hopefully this answers your questions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is using the CMD most appropriate over using docker run
on the resulting image. Per my original comments this is not going to be typical usage. Please change to place the verification logic in the test case.
{ | ||
appBuildArgs = new string[] | ||
{ | ||
$"BASE_BUILD_IMAGE={baseBuildImage}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be best to not have this duplicated. You could change appBuildArgs to a list and initialize it with the build image. The includeRuntime case could then add the runtime image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be addressed in the next PR update.
{ | ||
DockerHelper.DeleteImage(appId); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple WS changes? Were those intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed a merge conflict, is this still an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is. You can see it very easily in the diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is WS? Sorry, I don't see it. All the changes in ImageTests.cs are intentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WS is whitespace. Your changes include new blank lines that I don't think add value and make the styling inconsistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, it will be removed.
} | ||
|
||
public void Build(string tag, string dockerfile, string buildContextPath, params string[] buildArgs) | ||
public void Build(string tag, string dockerfile, string buildContextPath, StringCollection buildArgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IEnumerable{string} seems more appropriate as there no dependency on StringCollection.
public void VerifyImagesWithWebApps(ImageDescriptor imageDescriptor) | ||
{ | ||
VerifyImages(imageDescriptor, "webapp", false); | ||
VerifyImages(imageDescriptor, "webapp", $"powershell -command \"dir ./bin/SimpleWebApplication.dll\"", false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- String interpolation is not being used therefore the
$
is not necessary.
@MichaelSimons please review the latest update. Will you please merge and approve this PR so we could get this done? |
} | ||
|
||
public void Build(string tag, string dockerfile, string buildContextPath, StringCollection buildArgs) | ||
public void Build(string tag, string dockerfile, string buildContextPath, List<string> buildArgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the need to take a dependency on List This method just needs to enumerate? IEnumerable{string} allows the caller to pass in a variety of types - arrays, lists, collection, etc..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was not an easy way to add to IEnumerable , that is why I used List here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is wrong with
public void Build(string tag, string dockerfile, string buildContextPath, IEnumerable<string> buildArgs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is nothing wrong with that. What I need here is to initialize this collection with one string, and in some situation, Add another string to it. I did not see that IEnumerable supports Add method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List<string>
implements IEnumerable<string>
so you will be able to pass in a List<string>
type into a method that has an IEnumerable<string>
parameter.
if (buildArgs != null) | ||
{ | ||
foreach (string arg in buildArgs) | ||
foreach (Object arg in buildArgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should be reverted with your change to use IEnumerable<string>
Add Web testing projects.