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

Fix functional tests #3501

Merged
merged 6 commits into from
Jan 27, 2017
Merged

Fix functional tests #3501

merged 6 commits into from
Jan 27, 2017

Conversation

joelverhagen
Copy link
Member

  1. UploadPackageFromUI was improperly asserting 503 against a non-read-only server.
  2. Remove checks that skipped test logic based on ReadOnly flag. This is the wrong way to skip tests.

Addresses https://github.com/NuGet/Engineering/issues/188.

Found https://github.com/NuGet/Engineering/issues/200 in the process. Will address separately.

private static List<string> _trustedHttpsCertificates;

/// <summary>
/// Option to enable or disable functional tests from the current run.
/// </summary>
public static string RunFunctionalTests
public static bool RunFunctionalTests
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the use case for this setting?

Copy link
Member Author

Choose a reason for hiding this comment

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

The gallery test fixture requires that this environment variable is set to true to run:

#if DEBUG
#else
if (!EnvironmentSettings.RunFunctionalTests.Equals("True", System.StringComparison.OrdinalIgnoreCase))
{
throw new System.InvalidOperationException("Functional tests are disabled in the current run. Please set environment variable RunFuntionalTests to True to enable them");
}
#endif

Copy link
Contributor

Choose a reason for hiding this comment

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

But why will we ever want to turn it off?

Copy link
Member Author

Choose a reason for hiding this comment

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

This setting is not necessary. Removed.

}
}
bool runFunctionalTests;
if (!bool.TryParse(Environment.GetEnvironmentVariable("RunFunctionalTests"), out runFunctionalTests))
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to distinguish between the cases:

  1. Config is empty (null or empty string)
  2. TryParse fails because the value is not "true"/"false"

Also, consider if you want to lowercase the value before parsing. If I remember correctly, "True" might fail to be parsed

Copy link
Member Author

Choose a reason for hiding this comment

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

We should be able to distinguish between the cases:

Why?

Also, consider if you want to lowercase the value before parsing. If I remember correctly, "True" might fail to be parsed

Nope, bool.TryParse accepts different casings and whitespace prefix/suffix.
https://dotnetfiddle.net/DijWeC

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. if the config is empty, the user didn't add a value to the setting, and we should fallback to default behavior (what ever we decide it is).
    If the user wrote "blablabla" in the setting, we need to fail on parsing, and show that we failed on parsing, instead of swallowing the error.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that depends on the case. But I'm pretty sure we can just remove this setting completely.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good :)

Copy link
Member Author

Choose a reason for hiding this comment

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

By the way the previous implementation only reacted to "True" case-insensitive. It fell back to false for "blablablah".

Copy link
Member Author

Choose a reason for hiding this comment

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

This setting is not necessary. Removed.

using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.WebTesting;
using NuGetGallery.FunctionalTests.Helpers;

namespace NuGetGallery.FunctionalTests.WebUITests.ReadOnlyMode
{
/// <summary>
/// Go Account management activities like "Unsunscribe" notications and "Reset" Api key in read-only mode and check for error.
/// Go Account management activities like "Unsubscribe" notications and "Reset" Api key in read-only mode and check for error.
Copy link
Contributor

Choose a reason for hiding this comment

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

like :)

@joelverhagen joelverhagen merged commit 5352539 into NuGet:dev Jan 27, 2017
@joelverhagen joelverhagen deleted the fix-ft2 branch January 27, 2017 01:54
@joelverhagen joelverhagen mentioned this pull request Jan 27, 2017
6 tasks
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.

3 participants