Esempio n. 1
0
        public void ApplyToTest(NUnit.Framework.Internal.Test test)
        {
            var expectedVersion = GetExpectedServerVersion();

            if (!TestClusterManager.IsDse && IsDseRequired())
            {
                test.RunState = RunState.Ignored;
                var message = string.Format("Test designed to run with DSE {0} v{1} (executing OSS {2})",
                                            TestDseVersion.GetComparisonText(Comparison),
                                            expectedVersion,
                                            TestClusterManager.CassandraVersion);
                test.Properties.Set("_SKIPREASON", message);
                return;
            }

            var executingVersion = TestClusterManager.IsDse ? TestClusterManager.DseVersion : TestClusterManager.CassandraVersion;

            if (!TestDseVersion.VersionMatch(expectedVersion, executingVersion, Comparison))
            {
                test.RunState = RunState.Ignored;
                var message = string.Format("Test designed to run with DSE {0} v{1} (executing {2})",
                                            TestDseVersion.GetComparisonText(Comparison),
                                            expectedVersion,
                                            executingVersion);
                test.Properties.Set("_SKIPREASON", message);
            }
        }
        public static bool VersionMatch(Version expectedVersion, bool requiresDse, bool requiresOss, Comparison comparison, out string message)
        {
            if (TestClusterManager.IsDse && requiresOss)
            {
                message = string.Format("Test designed to run with OSS {0} v{1} (executing DSE {2})",
                                        TestDseVersion.GetComparisonText(comparison),
                                        expectedVersion,
                                        TestClusterManager.DseVersion);
                return(false);
            }

            if (!TestClusterManager.IsDse && requiresDse)
            {
                message = $"Test designed to run with DSE {TestDseVersion.GetComparisonText(comparison)} " +
                          $"v{expectedVersion} (executing OSS {TestClusterManager.CassandraVersion})";
                return(false);
            }

            var executingVersion = TestClusterManager.IsDse ? TestClusterManager.DseVersion : TestClusterManager.CassandraVersion;

            if (!TestDseVersion.VersionMatch(expectedVersion, executingVersion, comparison))
            {
                message =
                    $"Test designed to run with DSE {TestDseVersion.GetComparisonText(comparison)} v{expectedVersion} (executing {executingVersion})";
                return(false);
            }

            message = null;
            return(true);
        }
        public void ApplyToTest(NUnit.Framework.Internal.Test test)
        {
            var expectedVersion = GetExpectedServerVersion();

            if (!TestDseVersion.VersionMatch(expectedVersion, IsDseRequired(), IsOssRequired, Comparison, out var msg))
            {
                test.RunState = RunState.Ignored;
                var message = msg;
                test.Properties.Set("_SKIPREASON", message);
            }
        }
 public static bool VersionMatch(Version expectedVersion, bool requiresDse, bool requiresOss, Comparison comparison)
 {
     return(TestDseVersion.VersionMatch(expectedVersion, requiresDse, requiresOss, comparison, out _));
 }