flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-4552) Refactor WindowOperator/Trigger Tests
Date Fri, 28 Oct 2016 09:31:58 GMT

    [ https://issues.apache.org/jira/browse/FLINK-4552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15614896#comment-15614896

ASF GitHub Bot commented on FLINK-4552:

Github user aljoscha commented on a diff in the pull request:

    --- Diff: flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/EventTimeSessionWindowsWindowsTest.java
    @@ -0,0 +1,175 @@
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.flink.streaming.runtime.operators.windowing;
    +import com.google.common.collect.Lists;
    +import org.apache.flink.api.common.ExecutionConfig;
    +import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
    +import org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows;
    +import org.apache.flink.streaming.api.windowing.assigners.MergingWindowAssigner;
    +import org.apache.flink.streaming.api.windowing.assigners.WindowAssigner;
    +import org.apache.flink.streaming.api.windowing.time.Time;
    +import org.apache.flink.streaming.api.windowing.triggers.EventTimeTrigger;
    +import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
    +import org.apache.flink.util.TestLogger;
    +import org.junit.Test;
    +import org.mockito.Matchers;
    +import java.util.Collection;
    +import static org.apache.flink.streaming.runtime.operators.windowing.StreamRecordMatchers.timeWindow;
    +import static org.hamcrest.CoreMatchers.containsString;
    +import static org.hamcrest.Matchers.contains;
    +import static org.hamcrest.Matchers.containsInAnyOrder;
    +import static org.hamcrest.Matchers.instanceOf;
    +import static org.junit.Assert.*;
    +import static org.mockito.Matchers.anyCollection;
    +import static org.mockito.Mockito.*;
    + * Tests for {@link EventTimeSessionWindows}
    + */
    +public class EventTimeSessionWindowsWindowsTest extends TestLogger {
    +	@Test
    +	public void testWindowAssignment() {
    +		WindowAssigner.WindowAssignerContext mockContext =
    +				mock(WindowAssigner.WindowAssignerContext.class);
    +		EventTimeSessionWindows assigner = EventTimeSessionWindows.withGap(Time.milliseconds(5000));
    --- End diff --

> Refactor WindowOperator/Trigger Tests
> -------------------------------------
>                 Key: FLINK-4552
>                 URL: https://issues.apache.org/jira/browse/FLINK-4552
>             Project: Flink
>          Issue Type: Improvement
>          Components: Windowing Operators
>            Reporter: Aljoscha Krettek
>            Assignee: Aljoscha Krettek
> Right now, tests for {{WindowOperator}}, {{WindowAssigner}}, {{Trigger}} and {{WindowFunction}}
are all conflated in {{WindowOperatorTest}}. All of these test that a certain combination
of a {{Trigger}}, {{WindowAssigner}} and {{WindowFunction}} produce the expected output.
> We should modularize these tests and spread them out across multiple files, possibly
one per trigger, for the triggers. Also, we should extend/change the tests in some key ways:
>  - {{WindowOperatorTest}} test should just verify that the interaction between {{WindowOperator}}
and the various other parts works as expected, that the correct methods on {{Trigger}} and
{{WindowFunction}} are called at the expected time and that snapshotting, timers, cleanup
etc. work correctly. These tests should also verify that the different state types and {{WindowFunctions}}
work correctly.
>  - {{Trigger}} tests should present elements to triggers and verify that they fire at
the correct times. The actual output of the {{WindowFunction}} is not important for these
tests. We should also test that triggers correctly clean up state and timers.
>  - {{WindowAssigner}} tests should test each window assigner and also verify that, for
example, the offset parameter of time-based windows works correctly.
> There is already {{WindowingTestHarness}} but it is not used by tests, I think we can
expand on that and provide more thorough test coverage while also making the tests more maintainable
({{WindowOperatorTest.java}} is nearing 3000 lines of code).

This message was sent by Atlassian JIRA

View raw message