Index: tests/phpunit/tests/comment/metaCache.php
===================================================================
--- tests/phpunit/tests/comment/metaCache.php	(revision 40943)
+++ tests/phpunit/tests/comment/metaCache.php	(working copy)
@@ -88,6 +88,56 @@
 	}
 
 	/**
+	 * @ticket 40669
+	 */
+	public function test_comment_meta_cache_invalidation() {
+		global $wpdb;
+
+		$p = self::factory()->post->create( array( 'post_status' => 'publish' ) );
+		$comment_ids = self::factory()->comment->create_post_comments( $p, 3 );
+		$other_comment_ids = self::factory()->comment->create_post_comments( $p, 2 );
+		foreach ( $comment_ids as $cid ) {
+			add_comment_meta( $cid, 'sauce', 'fire' );
+		}
+
+		$this->assertSame( 3, get_comments( array(
+			'post_id'    => $p,
+			'count' => true,
+			'meta_query' => array(
+				array(
+					'key'     => 'sauce',
+					'value'   => 'fire'
+				),
+			)
+		) ) );
+		$this->assertSame( 3, get_comments( array(
+			'post_id'    => $p,
+			'count' => true,
+			'meta_query' => array(
+				array(
+					'key'     => 'sauce',
+					'value'   => 'fire'
+				),
+			)
+		) ) );
+
+		foreach ( $other_comment_ids as $cid ) {
+			add_comment_meta( $cid, 'sauce', 'fire' );
+		}
+
+		$this->assertSame( 6, get_comments( array(
+			'post_id'    => $p,
+			'count' => true,
+			'meta_query' => array(
+				array(
+					'key'     => 'sauce',
+					'value'   => 'fire'
+				),
+			)
+		) ) );
+	}
+
+	/**
 	 * @ticket 16894
 	 */
 	public function test_comment_meta_should_be_lazy_loaded_for_all_comments_in_comments_template() {
